根据ASP.Net中的列表框中选择的值动态创建选项卡 [英] Create Tabs Dynamically Based on Values Selected in Listbox in ASP.Net

查看:55
本文介绍了根据ASP.Net中的列表框中选择的值动态创建选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我如何根据从列表框中选择的内容动态创建标签?



这就是我所拥有的:



列表框:

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:




RetrieveButton:

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





根据用户从列表框中选择的内容,当用户按下检索按钮时,将根据用户从列表框中选择的值的数量创建选项卡数。



例如:

假设用户从中选择了 3项列表框并单击按钮, 3个选项卡应在相同页面的页面底部创建,选项卡名称为列表框项目文本。



样本输出图示:


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



| ListBox |



| RetrieveButton |



--------------- ------------------------------------------------ <无线电通信/>


标签:

Apple |西瓜| Kiwi



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



任何帮助都很大赞赏。谢谢!



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!

推荐答案

这是做动态标签的一种方式。



请关注jsfiddle链接并按照代码。



点击此处 [< a href =http://jsfiddle.net/mvamsianil/cznzx31m/2/target =_ blanktitle =New Window> ^ ]



快乐的编码。 :)

RelicV
This is one way of doing the dynamic tabs.

Please follow the jsfiddle link and follow the code.

Click Here[^]

Happy coding. :)
RelicV


这篇关于根据ASP.Net中的列表框中选择的值动态创建选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆