Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, does anyone know how can I create tabs dynamically based on what is selected from a Listbox?

This is what I have:

Listbox:
 <asp:ListBox ID="SelectionListBox" runat="server" AppendDataBoundItems="True" SelectionMode="Multiple" Height="130px" Width="350px">
    <asp:ListItem Text="Apple" Value ="1"  />
    <asp:ListItem Text="Watermelon" Value ="2"  />
    <asp:ListItem Text="Kiwi" Value ="3"  />
    <asp:ListItem Text="Plum" Value ="4"  />
    <asp:ListItem Text="Pineapple" Value ="5"  />
</asp:ListBox>


RetrieveButton:

<asp:Button ID="RetrieveButton" runat="server" Text="Button" />


Based on what the user has selected from the Listbox, when the user pressed on the Retrieve button, number of tabs will be created based on the number of values user has selected from Listbox.

For example:
Let's say user has selected 3 items from the Listbox and click on the button, 3 tabs should be created at the bottom of the page on the same page with the tab names as the listbox items texts.

Sample Output Illustration:

---------------------------------------------------------------

|ListBox|

|RetrieveButton|

---------------------------------------------------------------

Tabs:
Apple | Watermelon | Kiwi

---------------------------------------------------------------

Any help is greatly appreciated. Thanks!
Posted
Updated 21-Sep-15 4:34am
v3
Comments
Andy Lanng 21-Sep-15 11:17am    
Do you have any tab controls or plans on how to create tabs?
Maciej Los 21-Sep-15 12:47pm    
Have you tried anything?

1 solution

This is one way of doing the dynamic tabs.

Please follow the jsfiddle link and follow the code.

Click Here[^]

Happy coding. :)
RelicV
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900