DropDownList设置选定项

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("中国"));
如果通过FindByValue没有找到指定项则为null,而Items.IndexOf(null)会返回-1

网友 -> selectedValue=“中国”;

大家高兴吧!

相关文章:

  • 2022-01-06
  • 2022-12-23
  • 2021-09-05
  • 2021-11-05
  • 2021-08-28
  • 2021-08-14
  • 2021-09-12
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2021-05-31
  • 2021-09-03
  • 2021-11-12
相关资源
相似解决方案