天天看點

asp.net中dropdownList綁定已有資訊

我們在修改操作的時候,需要綁定該對象已經有的資訊,那麼怎麼辦呢?

方法一:

this.dropdownlist1.selectedindex = this.dropdownlist1.items.indexof(this.dropdownlist1.items.findbytext("字元串"));

或者

this.dropdownlist1.selectedindex = this.dropdownlist1.items.indexof(this.dropdownlist1.items.findbyvalue("字元串"));

方法二:

在dropdownlist1的databound事件中寫:

dropdownlist1.items.findbyvalue("字元串").selected=true;

dropdownlist1.items.findbytext(“字元串").selected = true;

原帖位址:http://hi.baidu.com/suyineng/blog/item/514de33cdcea1308baa167ae.html

繼續閱讀