DropDownList1,DropDownList2都是从数据库里读数据,然后两个DropDownList里添加
ListItem aa = new ListItem();
aa.Text = "请选择";
aa.Value = "0";
DropDownList1.Items.Insert(0,aa);
DropDownList2.Items.Insert(0,aa);
当我进行数据定位的时候
DropDownList1.SelectedValue = "1";
DropDownList2.SelectedValue = "0";
失败!
DropDownList1.SelectedValue = "1";
DropDownList2.SelectedValue = "1";
成功!
DropDownList1.SelectedValue = "0";
DropDownList2.SelectedValue = "1";
成功!
DropDownList1.SelectedValue = "0";
DropDownList2.SelectedValue = "0";
成功!
失败的时候提示:DropDownList 不能有多个项被选定。
郁闷了
ListItem aa = new ListItem();
aa.Text = "请选择";
aa.Value = "0";
DropDownList1.Items.Insert(0,aa);
DropDownList2.Items.Insert(0,aa);
当我进行数据定位的时候
DropDownList1.SelectedValue = "1";
DropDownList2.SelectedValue = "0";
失败!
DropDownList1.SelectedValue = "1";
DropDownList2.SelectedValue = "1";
成功!
DropDownList1.SelectedValue = "0";
DropDownList2.SelectedValue = "1";
成功!
DropDownList1.SelectedValue = "0";
DropDownList2.SelectedValue = "0";
成功!
失败的时候提示:DropDownList 不能有多个项被选定。
郁闷了
解决方案 »
- 【提问】dropdownlist 不触发selectedindexchanged
- 请问页面回发时为什么不能取到Session?
- gridview选择数据源
- 关于用FileUpload上传文件夹问题
- 如何将DataView型转换成DataTable型
- 网页不会被缓存 这个在NET中是怎么写的呢?
- 为啥在datagrid的超级链点不了鼠标显示1字而不是手型也点不了链接
- 在datagrid中嵌入html控件file field后,在datagrid编辑模式下怎样获取当前选择的文件?急!!
- 两台电脑,其中一台发布了asp.net应用程序,该应用程序有一功能要求上传附件到另一台电脑上,同时要求可以显示附件.
- 求sql 存储过程
- 求助:怎么我连接OLE DB数据源出错了!
- 做网站的兄弟,大家来谈谈网站具体该如何做
DropDownList1.Items.Clear();
如:DropDownList1.SelectIndex = -1;
否则会有你说的错误提示
具体示例如下:DropDownList1.SelectValue = '1';
DropDownList1.SelectIndex = -1;//清除之前的选定,否则下步出错
DropDownList1.SelectValue = '0'