Introduction
In this article we will see how to use an Ajax TabContainer in ASP.NET. As you all know, creating a tab in an ASP.Net web application is something critical. To create a control like a tab in our ASP.Net application we can use a muliview control with various views but again same keeping some buttons to change the ActiveViewIndex of multiview control. This causes a postback to the server and for changing the view we only have to wait until the page reloads.
You all know in Windows applications we have a tabcontainer control which is collection of tabpages but in ASP.Net that kind of control is not available but using Ajax we can create a tabcontainer control. So let's start using Ajax TabContainer control.
Step 1:
Create a new website and add a reference to AjaxControlToolkit.
Step 2:
Register the tagprefix references to AjaxControlToolkit like below.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Step 3:
Now first we need to keep one scriptmanger control on our ASP.Net web page so keep it like given below.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
Step 4:
Now it's time to put the tabcontainer control of Ajax but remember the Ajax TabContainer control doesn't have TabPages where we can add TabPages like in Windows form. In the Ajax TabContainer we have TabPanels like tab pages in a Windows form. So add a TabContainer on the page like below.
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
Width="600">
</cc1:TabContainer>
Above we created an empty tabcontainer control that does not have a tabpanel in it. Next we will create tabpages for our tabcontainer.
Step5:
Now create tabpanels for our tabcontainer control like below:
<cc1:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate></HeaderTemplate>
<ContentTemplate></ContentTemplate>
</cc1:TabPanel>
In the above line you are seen there are two templates; one is a HeaderTemplate and another is a ContentTemplate. In the HeaderTamplate you can provide the header for a TabPanel and in the ContentTemplate you can put any another controls in it.
<cc1:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate>
Tab Panel One
</HeaderTemplate>
<ContentTemplate>
<asp:Image ID="Image1" runat="server" Height="140px" ImageUrl="~/dg1.gif"
Width="138px" />
Tab Panel1
</ContentTemplate>
</cc1:TabPanel>
In this way you can create a TabContainer and TabPanels in ASP.Net as well; you can use your own styles for the TabContainer as well as TabPanels. The following is the complete source for a tabcontainer.
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
Width="600">
<cc1:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate>
Tab Panel One
</HeaderTemplate>
<ContentTemplate>
<asp:Image ID="Image1" runat="server" Height="140px" ImageUrl="~/dg1.gif"
Width="138px" />
Tab Panel1
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server">
<HeaderTemplate>
Tab Panel Two
</HeaderTemplate>
<ContentTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem>Items</asp:ListItem>
<asp:ListItem>Items</asp:ListItem>
<asp:ListItem>Items</asp:ListItem>
<asp:ListItem>Itens</asp:ListItem>
<asp:ListItem>Items</asp:ListItem>
<asp:ListItem>Items</asp:ListItem>
</asp:RadioButtonList>
<asp:Image ID="Image3" runat="server" Height="89px" ImageUrl="~/dg2.gif"
Width="122px" />
Tab Panel2
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server">
<HeaderTemplate>
Tab Panel Three
</HeaderTemplate>
<ContentTemplate>
<asp:Image ID="Image2" runat="server" Height="151px" ImageUrl="~/dg3.gif"
Width="106px" />
Tab panel 3
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
Conclusion:
In this way you can create the tabcontainer control in ASP.Net and keep more of the content in just one page.

Krishna GaradPosted Aug 28, 2012, 6:19 AM
both are perfomance effective. You can use jquery rather than ajax.
PUNEET BISHTPosted Aug 28, 2012, 4:42 AM
as per performance (speed +flexibility) which would be beter to use - ajax tab container or a jquery tab
Jaspreet KaurPosted Apr 24, 2012, 3:04 PM
okay!!! then what should be done to correct it as i am beginner of asp.net. don't know much about it.google chrome browser is used me.
Krishna GaradPosted Apr 24, 2012, 12:56 AM
It might be cross browser issue with your stylesheet. Check it
Jaspreet KaurPosted Apr 23, 2012, 7:48 PM
sir,I have used this code in my project. but it is not shown when i debug it. I have done visibility of tab container to true but still it is not shown. kindly tell me what to do thanks
Jaspreet KaureditedPosted Apr 23, 2012, 7:44 PMEdited Apr 23, 2012, 7:45 PM
very nice article thanks.
freddy andersenPosted Feb 12, 2012, 1:10 AM
Thanks for your article - but really - give us some grown up stuff. Give us a tabcontainer with tabs on the right side, tabs with customable style and size, and tabs with images. Looking foreward to see your dev
Manish SinghPosted Jan 20, 2012, 11:28 PM
I hope next is more helpful
Arjun PanwarPosted Jan 20, 2012, 11:20 PM
Really thanks for this article