When you have a tab container within a user control that is added programmatically, only the controls in the first tab show up, the other tabs are blank.
But when you place the same control onto a page directly within the .aspx file, everything works correctly.
sample code below:
test.aspx:
```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<%@ Register Src="~/TestTabs.ascx" TagPrefix="uc1" TagName="TestTabs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="True"></ajaxToolkit:ToolkitScriptManager>
<div>
<asp:PlaceHolder runat="server" ID="ContentPlace"></asp:PlaceHolder>
</div>
</form>
</body>
</html>
```
test.aspx.cs
```
using System;
public partial class DTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var ctrl = LoadControl("TestTabs.ascx");
ContentPlace.Controls.Add(ctrl);
}
}
```
TestTabs.ascx
```
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestTabs.ascx.cs" Inherits="TestTabs" %>
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server"
Width="810px"
ActiveTabIndex="0"
OnDemand="true"
TabStripPlacement="Top"
ScrollBars="Auto" Height="300px">
<ajaxToolkit:TabPanel ID="TabPanel1" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label runat="server" Text="Page #1"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel2" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Page #2"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel3" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Page #3"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
```
But when you place the same control onto a page directly within the .aspx file, everything works correctly.
sample code below:
test.aspx:
```
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<%@ Register Src="~/TestTabs.ascx" TagPrefix="uc1" TagName="TestTabs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="True"></ajaxToolkit:ToolkitScriptManager>
<div>
<asp:PlaceHolder runat="server" ID="ContentPlace"></asp:PlaceHolder>
</div>
</form>
</body>
</html>
```
test.aspx.cs
```
using System;
public partial class DTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var ctrl = LoadControl("TestTabs.ascx");
ContentPlace.Controls.Add(ctrl);
}
}
```
TestTabs.ascx
```
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestTabs.ascx.cs" Inherits="TestTabs" %>
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server"
Width="810px"
ActiveTabIndex="0"
OnDemand="true"
TabStripPlacement="Top"
ScrollBars="Auto" Height="300px">
<ajaxToolkit:TabPanel ID="TabPanel1" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label runat="server" Text="Page #1"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel2" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Page #2"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel3" runat="server"
HeaderText="Modules"
Enabled="true"
TabIndex="0"
ScrollBars="Auto">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Page #3"></asp:Label>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
```