Sruthi Suresh
Sruthi Suresh

Reputation: 697

Hiding first TabPanel of TabContainer hides the TabContainer

I have an ajax tab container with 3 tabs.the problem is that when I make the first tab invisible,it makes the entire tab container invisible. i have something like

<tk:TabContainer ID="TabContainer1" runat="server"   >

     <tk:TabPanel ID="Tabpanell" runat="server" >
</tk:TabPanel>
<tk:TabPanel ID="Tabpanel2" runat="server" >
</tk:TabPanel>
<tk:TabPanel ID="Tabpanel3" runat="server" >
</tk:TabPanel>
</tk:TabContainer>

and in code behind,on page load i need to show only some tabpanels based on condition that is..

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
          if (!CheckViewPermissionTab1())
           {
             Tabpanel1.visible=false;
           }
        }
    }

but when i try to set the first tabpanel's visibilit to false ,the entire tab container gets hidden.There is no problem whwn the second or third panel's visibility is set to false.

Upvotes: 1

Views: 2054

Answers (1)

Sankar
Sankar

Reputation: 7107

The problem is tabcontainer need atleast a tab should be active otherwise it will go invisible so if you set a tab to visible=false, then you have to set any other tab to be active.

 protected void Page_Load(object sender, EventArgs e) 
 { 
    if (!IsPostBack) 
    { 
        if (!CheckViewPermissionTab1()) 
        { 
            Tabpanel1.visible=false; 
            TabContainer1.ActiveTab = Tabpanel2; 
        } 
     } 
 }

Try the above code.

Upvotes: 2

Related Questions