閱讀57 返回首頁    go 阿裏雲 go 技術社區[雲棲]


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;


 

原帖地址:https://hi.baidu.com/suyineng/blog/item/514de33cdcea1308baa167ae.html

最後更新:2017-04-02 22:16:32

  上一篇:go android sdk 編譯--如何將源代碼加入android.jar,以及make原理
  下一篇:go java中利用itext.jar生成word文檔