hi,
i have a problem with my tabcontainer that once user click the tab, it will not remains the tab but goes to the default tab..
This is my code

<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>    
             <cc1:TabContainer ID="MyTabContainer" runat="server" ActiveTabIndex="0>
       
                <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Company">
                    <ContentTemplate>
                        <a href="<%= Page.ResolveUrl("~")%>MASTER/Company_a.aspx" >Company Entry</a>&nbsp;&nbsp;&nbsp;
                        <a href ="<%= Page.ResolveUrl("~")%>MASTER/Company_v.aspx">View Company </a>&nbsp;&nbsp;&nbsp;
                    </ContentTemplate>
                </cc1:TabPanel>
               
                <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="User">
                    <ContentTemplate>                      
                        <a href ="<%= Page.ResolveUrl("~")%>MASTER/User_a.aspx">User Entry </a>&nbsp;&nbsp;&nbsp;
                        <a href ="<%= Page.ResolveUrl("~")%>MASTER/User_v.aspx">View User </a>
                    </ContentTemplate>
                </cc1:TabPanel>
                          
                <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                    <ContentTemplate>
                        Tab 3
                    </ContentTemplate>
                </cc1:TabPanel>
           
            </cc1:TabContainer>

Recommended Answers

All 4 Replies

Member Avatar for siju kuriakose

Hi,
You have to set the active tab index property after the event completed on a particular tab to the tab index(on page load).
hope your reply

protected void Page_Load(object sender, System.EventArgs e) 
    {
         if ( !(ViewState["ActiveTabIndex"] == null) && (! (sender == null))) 
        {
            if (sender.GetType().ToString().Equals("AjaxControlToolkit.TabContainer")) 
            {
                ((AjaxControlToolkit.TabContainer)sender).ActiveTabIndex = (int)ViewState["ActiveTabIndex"];
            }

        }

    }
    protected void MyTabContainer_ActiveTabChanged(object sender, EventArgs e)
    {
        ViewState["ActiveTabIndex"] = MyTabContainer.ActiveTabIndex;
    }

this is what i have tried, but did't work..
can you explain a little bit more

Member Avatar for siju kuriakose

Hi,
No need to set the active tabindex on activetabchanged event normaly.You have to set the active tab index to on pageload if you want to display the required tab after a particular event fired from that tab like post comments etc.
Usually without any help of code the tabcontainer shows the selected tab by clicking on it.
hope your reply

actually i cannot how all those thing work..can you show me some sample code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.