Problem with TabPanel Control ActiveTab
Hello everybody,
The ActiveTab propriety does not work for me and has always the value -1.
This is my code:
Page.aspx
Code:
<ext:TabPanel ID="tabs" runat="server" AutoPostBack="true" Title="TabPanel">
</ext:TabPanel>
Page.aspx..cs
Code:
protected void Page_Load(object sender, EventArgs e){
tabs.TabWidth = Unit.Pixel(135);
tabs.EnableTabScroll = true;
tabs.AutoPostBack = true;
tabs.TabChanged += new EventHandler(tabs_TabChanged);
Tab tab1 = new Tab();
tabMytheme.AutoWidth = true;
tabMytheme.ID = "tab1";
Tab tab2 = new Tab();
tabMytheme.AutoWidth = true;
tabMytheme.ID = "tab2"; tabs.Tabs.Add(tab1);
tabs.Tabs.Add(tab2);
...
}
.....
protected void tabs_TabChanged(object sender, EventArgs e)
{
TabPanel tabpanel = (TabPanel)sender;
Tab tab = tabpanel.Tabs[tabpanel.ActiveTab]; // The tabpanel.ActiveTab has always the value -1
string idProgramme = tab.ID;
...
}
Thank you for help !
RE: Problem with TabPanel Control ActiveTab
Problem resolved !
I have replaced
Code:
<ext:TabPanel ID="tabs" runat="server" AutoPostBack="true" Title="TabPanel">
</ext:TabPanel>
by
Code:
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
And I have added this
Code:
this.PlaceHolder1.Controls.Add(tabs);
RE: Problem with TabPanel Control ActiveTab
Thanks for the update.
I feel your original attempt should have worked, and I suspected there was a problem in the TabPanel's LoadPostData Method. I'm going to try and figure exactly what is going wrong.