Hi amolgurude,
Refer below example.
HTML
<style type="text/css">
.NewsTab .ajax__tab_header {
font-family: "Helvetica Neue", Arial, Sans-Serif;
font-size: 14px;
font-weight: bold;
display: block;
}
.NewsTab .ajax__tab_header .ajax__tab_outer {
border-color: #222;
color: #222;
padding-left: 10px;
margin-right: 3px;
border: solid 1px #d7d7d7;
}
.NewsTab .ajax__tab_header .ajax__tab_inner {
border-color: #666;
color: #666;
padding: 3px 10px 2px 0px;
}
.NewsTab .ajax__tab_hover .ajax__tab_outer {
background-color: #9c3;
}
.NewsTab .ajax__tab_hover .ajax__tab_inner {
color: #fff;
}
.NewsTab .ajax__tab_active .ajax__tab_outer {
border-bottom-color: #ffffff;
background-color: #d7d7d7;
}
.NewsTab .ajax__tab_active .ajax__tab_inner {
color: #000;
border-color: #333;
}
.NewsTab .ajax__tab_body {
font-family: verdana,tahoma,helvetica;
font-size: 10pt;
background-color: #fff;
border-top-width: 0;
border: solid 1px #d7d7d7;
border-top-color: #ffffff;
}
</style>
<asp:ScriptManager runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:TabContainer ID="TabContentCategoryList" runat="server" CssClass="NewsTab"
Width="100%" ActiveTabIndex="1">
<cc1:TabPanel ID="TabPFarmProfile" runat="server" HeaderText="All">
<ContentTemplate>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DynamicTab();
}
private System.Data.DataSet KnowledgeRepository()
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("ContentType_ID");
dt.Columns.Add("Content_Type");
dt.Rows.Add(4, "category1");
dt.Rows.Add(5, "category2");
dt.Rows.Add(6, "category12");
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(dt);
return ds;
}
protected void DynamicTab()
{
TabContentCategoryList.Tabs.Clear();
System.Data.DataSet Dt = KnowledgeRepository();
if (Dt.Tables.Count > 0)
{
System.Data.DataTable dtcontenttype = Dt.Tables[0];
foreach (System.Data.DataRow drp in dtcontenttype.Rows)
{
AjaxControlToolkit.TabPanel tblCategorylist = new AjaxControlToolkit.TabPanel();
tblCategorylist.HeaderText = drp["Content_Type"].ToString();
tblCategorylist.ID = drp["ContentType_ID"].ToString();
tblCategorylist.ContentTemplate = null;
TabContentCategoryList.Tabs.Add(tblCategorylist);
}
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
DynamicTab()
End Sub
Private Function KnowledgeRepository() As System.Data.DataSet
Dim dt As System.Data.DataTable = New System.Data.DataTable()
dt.Columns.Add("ContentType_ID")
dt.Columns.Add("Content_Type")
dt.Rows.Add(4, "category1")
dt.Rows.Add(5, "category2")
dt.Rows.Add(6, "category12")
Dim ds As System.Data.DataSet = New System.Data.DataSet()
ds.Tables.Add(dt)
Return ds
End Function
Protected Sub DynamicTab()
TabContentCategoryList.Tabs.Clear()
Dim Dt As System.Data.DataSet = KnowledgeRepository()
If Dt.Tables.Count > 0 Then
Dim dtcontenttype As System.Data.DataTable = Dt.Tables(0)
For Each drp As System.Data.DataRow In dtcontenttype.Rows
Dim tblCategorylist As AjaxControlToolkit.TabPanel = New AjaxControlToolkit.TabPanel()
tblCategorylist.HeaderText = drp("Content_Type").ToString()
tblCategorylist.ID = drp("ContentType_ID").ToString()
tblCategorylist.ContentTemplate = Nothing
TabContentCategoryList.Tabs.Add(tblCategorylist)
Next
End If
End Sub
Screenshot