dropdownlist 项被选中的问题
来源:百度知道 编辑:UC知道 时间:2024/06/05 11:20:18
dropdownlist 里的 项 怎么根据 给定的值 来 selected 呢?
要循环遍历吗? 在绑定的时候就可以遍历
dropdownlist.Items(1).Selected=true 这个Items(1) 的 1 是索引吧?
问这么菜的问题,高手莫笑话哈!!!
要循环遍历吗? 在绑定的时候就可以遍历
dropdownlist.Items(1).Selected=true 这个Items(1) 的 1 是索引吧?
问这么菜的问题,高手莫笑话哈!!!
直接用this.dropdownlist.selectedvalue就OK了.
selectedvalue是选中项的值.
selectedtext是选中项显示的文字.
selectedindex是选中项的索引.
dropdownlist.Items.FindByValue("aa").Selected = true;
或者
dropdownlist.SelectedValue="aa";
selectedvalue是选中项的值.
selectedtext是选中项显示的文字.
selectedindex是选中项的索引.
是。。。你 要是就像获取他选定项的值。。。
dropdownlist.selectvalues();
当然不要遍历了.
DropDownList1.SelectedValue = str;//str就是你要显示的那个值了