DropDownList比较好的设置值的方式

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(xxx));
通过FindByValue没有找到指定项返回值为null,而Items.IndexOf(null)会返回-1

posted @ 2011-04-27 15:10  广林  阅读(196)  评论(0编辑  收藏  举报