PDA

View Full Version : Problem with TabPanel Control ActiveTab



matmani
Jun 09, 2008, 12:20 PM
Hello everybody,

The ActiveTab propriety does not work for me and has always the value -1.

This is my code:

Page.aspx



<ext:TabPanel ID="tabs" runat="server" AutoPostBack="true" Title="TabPanel">

</ext:TabPanel>


Page.aspx..cs



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 !

matmani
Jun 09, 2008, 4:16 PM
Problem resolved !

I have replaced



<ext:TabPanel ID="tabs" runat="server" AutoPostBack="true" Title="TabPanel">
</ext:TabPanel>


by



<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>


And I have added this



this.PlaceHolder1.Controls.Add(tabs);

geoffrey.mcgill
Jun 09, 2008, 8:18 PM
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.