阅读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文档