Sep 24, 2008, 9:37 AM
[CLOSED] Dynamically adding controls to a tav
I tried to build a TabPanel dynamically: adding Tabs to TabPanel and Buttons to each tabs. In the follow I list a very simple example. Issues come as Buttons doesn't show up properly. They come on top of the TabPanel instead of being shown inside of each appropiate Tab.
In the example each Tab is added with a Panel which is suposed to hold the Buttons. I also tried to add Button to either the Tab.Items or Tab.Control collection directly but nothing happens
can anyone help please?
In the example each Tab is added with a Panel which is suposed to hold the Buttons. I also tried to add Button to either the Tab.Items or Tab.Control collection directly but nothing happens
can anyone help please?
protected void Page_Load(object sender, EventArgs e)
{
Coolite.Ext.Web.TabPanel tabs = new Coolite.Ext.Web.TabPanel();
tabs.ResizeTabs = true;
tabs.MinTabWidth = Unit.Pixel(115);
tabs.TabWidth = Unit.Pixel(135);
tabs.EnableTabScroll = true;
tabs.Width = Unit.Pixel(600);
tabs.Height = Unit.Pixel(300);
tabs.ActiveTab = 0;
tabs.BodyBorder = false;
tabs.Border = true;
for (int i = 1; i<4; i++)
{
Tab tab = new Tab();
tab.Title = "world " + i.ToString();
tab.IconCls = "tabs";
tab.Closable = false;
tab.BodyStyle = "padding: 6px;";
tab.Frame = false;
Coolite.Ext.Web.Panel p = new Coolite.Ext.Web.Panel();
for (int j = 0; j < i; j++)
{
Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button();
btn.Text = "type " + i.ToString() + "_" + j.ToString();
btn.ToolTip = "description for type " + i.ToString() + "_" + j.ToString();
btn.Visible = true;
p.Controls.Add(btn);
}
tab.Items.Add(p);
tabs.Tabs.Add(tab);
}
this.PlaceHolder1.Controls.Add(tabs);
}