DropDownList设置选定项
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("中国"));
如果通过FindByValue没有找到指定项则为null,而Items.IndexOf(null)会返回-1
网友 -> selectedValue=“中国”;
大家高兴吧!
DropDownList设置选定项
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("中国"));
如果通过FindByValue没有找到指定项则为null,而Items.IndexOf(null)会返回-1
网友 -> selectedValue=“中国”;
大家高兴吧!
相关文章: