Setting dropdownlist selecteditem programmatically

前端 未结 11 1728
北海茫月
北海茫月 2020-11-28 07:47

I want to set the selecteditem attribute for an ASP.Net dropdownlist control programmatically.

So I want to pass a value to the dropdownlist control to

11条回答
  •  一向
    一向 (楼主)
    2020-11-28 08:13

    Well if I understood correctly your question. The Solution for setting the value for a given dropdownlist will be:

    dropdownlist1.Text="Your Value";
    

    This will work only if the value is existing in the data-source of the dropdownlist.

提交回复
热议问题