I am trying to get a control tab inside another using ASP.NET and Ajax control toolkit , this is the code which i am using:
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
<asp:TabPanel runat="server" HeaderText="Main tab" ID="TabPanel1">
<ContentTemplate>
<asp:TabPanel HeaderText="Nested tab" ID="TabPanel2" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Delete" />
</ContentTemplate>
</asp:TabPanel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
but i am getting an exception saying that :
"Object reference not set to an instance of an object."
I do not know what to do here, because my design needs to have a tab panel inside another one, is this possible ?
The nested <asp:TabPanel>
should be in its own <asp:TabContainer>
, that is probably what the exception is about: the object reference is probably the container, and it is not set to an instance since it's missing for the nested tab.
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
<asp:TabPanel runat="server" HeaderText="Main tab" ID="TabPanel1">
<ContentTemplate>
<%-- You need another container before you can add a nested tab --%>
<asp:TabContainer ID="NestedContainer1" runat="server">
<asp:TabPanel HeaderText="Nested tab" ID="TabPanel2" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Delete" />
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
<%-- End of the second container --%>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>