`
wsql
  • 浏览: 11757070 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics