hi, I can create tab panels in tab container dynamically based on options user has selected from Listbox. Let's say there are 4 items in ListBox, 'Item1, Item2, Item3, Item4'. If user selected all 4 items, 4 tab panels will be created in tab container with header text as 'Item1, Item2, Item3, Item4', which is the option name in Listbox.
I would like to add content like chart to tab panel with specific header text. E.g. to add chart only to tab panel with header text 'Item1" only. How can I accomplish this?
This is my codes to create tab panel dynamically:
Aspx file:
<asp:listbox ID="SelectionListBox" runat="server" SelectionMode="Multiple" >
<asp:listitem>Select All</asp:listitem>
<asp:listitem>Item 1</asp:listitem>
<asp:listitem>Item 2</asp:listitem>
<asp:listitem>Item 3</asp:listitem>
<asp:listitem>Item 4</asp:listitem>
</asp:listbox>
<div>
<asp:scriptmanager ID="ScriptManager1" runat="server">
</asp:scriptmanager>
</div>
<asp:updatepanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<asp:placeholder ID="PlaceHolder1" runat="server"></asp:placeholder>
</contenttemplate>
</asp:updatepanel>
Cs file:
protected void RETRIEVE_BUTTON_Click(object sender, EventArgs e)
{
AjaxControlToolkit.TabContainer container = new AjaxControlToolkit.TabContainer();
container.ID = DateTime.Now.Millisecond.ToString();
container.EnableViewState = false;
container.Tabs.Clear();
container.Height = Unit.Pixel(500);
container.Width = Unit.Pixel(1200);
container.Tabs.AddAt(0, GetManualTab());
foreach (ListItem item in SelectionListBox.Items)
{
if (item.Selected)
{
Label tabContent = new Label();
tabContent.ID = "lbl_tab_";
tabContent.Text += item.Value;
AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
panel.HeaderText += item.Value;
container.Tabs.Add(panel);
panel.Controls.Add(tabContent);
}
}
PlaceHolder1.Controls.Add(container);
}
public AjaxControlToolkit.TabPanel GetManualTab()
{
AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
return panel;
}
Question: How to add content like
chart to tab panel with specific header text. For example: to add chart only to
tab panel with
header text 'Item1".
Appreciate if someone can help me on this, thanks a lot!!