How to set a dropdownlist item as selected in ASP.NET?

后端 未结 5 1493
栀梦
栀梦 2020-12-04 23:58

I want to set selecteditem for asp. net dropdownlist control programmatically.

So I want to pass a value to the dropdownlist control to set the selected item where i

5条回答
  •  不思量自难忘°
    2020-12-05 00:43

    dropdownlist.ClearSelection(); //making sure the previous selection has been cleared
    dropdownlist.Items.FindByValue(value).Selected = true;
    

提交回复
热议问题