当前位置: 代码迷 >> ASP.NET >> 多选ListBox怎样绑定到数据库?该如何解决
  详细解决方案

多选ListBox怎样绑定到数据库?该如何解决

热度:7605   发布时间:2013-02-26 00:00:00.0
多选ListBox怎样绑定到数据库?
我这里有个多选的ListBox,需要把选定的值存储到数据库中,以后还需要读取出来能够编辑。
一般的TextBox绑定Text属性就可以了,多选的ListBox怎么绑定呢?

------解决方案--------------------------------------------------------
foreach (ListItem item in ListBox1.Items)
{
if (item.Selected)
{
string s = item.Value; //.Text?
Label1.Text =s + Label1.Text;
}
}