多个选择列表框与下拉列表 [英] multiple selection list box vs dropdown list
问题描述
我的情况是:
提交页面:我有一个包含技术的列表框"lbTechnology".
用户可以多选它们,我通过用逗号分隔保存项目. (msoffice,msvisualstudio,sharepoint ...)排成一行.
查看页面:在下一页中,我要基于技术填充数据.
所以我想用技术(msoffice,msvisualstudio,sharepoint ...)填充下拉列表.
我正在将数据从db提取到数据集.
我如何在下拉列表中填写技术,例如:
全部
msoffice
msvisualstudio
共享点
任何人都可以就上述尽快提供帮助
在此先感谢您.
看到您的数据将采用CSV格式,那么您可以轻松地将拆分的string
数组用作datasource
到dropdownlist
即
Dropdownlist1.DataSource = YourCSVString.Split('',''); Dropdownlist1.DataBind();
如果有帮助,请 投票 和 接受答案 .
my scenario is:
Submit page: I have a list box ''lbTechnology'' containing technologies.
User can multiselect them and I am saving the items by seperating by comma. (msoffice, msvisualstudio, sharepoint...) in one row.
View page: In the next page I want to populate data based on technology.
So I want to fill dropdown list with the technologies (msoffice, msvisualstudio, sharepoint...)
I am fetching the data from db to dataset.
How can I fill the technologies in the drop down like:
All
msoffice
msvisualstudio
sharepoint
Can anybody help regarding the above ASAP
Thanks in advance.
See your data will be in CSV format then you can easily use splittedstring
array as adatasource
todropdownlist
i.e
Dropdownlist1.DataSource = YourCSVString.Split('',''); Dropdownlist1.DataBind();
Please vote and Accept Answer if it Helped.
string str = "msoffice,msvisualstudio,sharepoint"; DropDownList1.Items.Add("All"); foreach(string s in str.Split('','')) { DropDownList1.Items.Add(s); //Response.Write(s + "<br>"); }
这篇关于多个选择列表框与下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!