I have TabContainer, which I'm adding dynamically TabPanels to.
The problem is that if I do not have at least one Hard coded TabPanel, I can't see all TabPanels.
This is the TabContainer:
<cc1:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true" >
<cc1:TabPanel ID="TabPanel0" runat="server" HeaderText="TabPanel1" >
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
and this is the TabPanels adding:
for (int i = 0; i < WorkOrderTabs.AllTexts.Count; i++)
{
TabPanel tab = new TabPanel();
AttributesAndLabels AAL = new AttributesAndLabels(1, i);
tab.ID = "tabPanel" + (i+1);
tab.HeaderText = AAL.AllTexts[0];
tab.Visible = true;
Control pdage = Page.LoadControl(FH.SubUserControlersWorkOrderPath + WorkOrderTabs.AllTexts[i]);
TabContainer1.Tabs.Add(tab);
TabContainer1.Tabs[i+1].Controls.Add(pdage);
}
If I delete the Hard Coded TabPanel all dynamic TabPanels will become unvisiable.
really Strange.
The problem was that none of the TabPanels was active.
When you create TabPanels dynamically you need to put one of them as Active in the TabContainer.