多个选择列表框与下拉列表 [英] multiple selection list box vs dropdown list

查看:357
本文介绍了多个选择列表框与下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况是:
提交页面:我有一个包含技术的列表框"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 splitted string array as a datasource to dropdownlist

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屋!

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