asp.net中的列表框 [英] listbox in asp.net
本文介绍了asp.net中的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在asp.net中填充一个列表框.我有两列:一个是Datatext,另一个是Datavalue.它们具有逗号分隔的值,如下所示:
DataText(1、2、3)和Datavalue(1、2、3)
请指导我,如何通过for
循环或foreach
或其他一些非常简单的解决方案填充列表框?
在此先感谢
Hi,
I want to populate a listbox in asp.net. I have two columns: one Datatext and other Datavalue. They have comma separated values like this:
DataText(one,two,three) and Datavalue(1,2,3)
Please guide me, how can I populate the listbox through a for
loop or foreach
or through some other pretty simple solution?
Thanks in advance
推荐答案
获取值,split
it,然后使用for
循环并通过索引基于值添加列表项.试试吧!
Get the values,split
it and then use afor
loop and add listitems based on values via index. Give a try!
这篇关于asp.net中的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文