开发者

ASP.NET dropdown selected value?

开发者 https://www.devze.com 2022-12-30 08:54 出处:网络
I\'ve an ASP.NET dropdown list and getting selected value by using the .SelectedValue. I also set this value in so开发者_开发问答me cases by assigning to it. I seem to be randomly not getting this val

I've an ASP.NET dropdown list and getting selected value by using the .SelectedValue. I also set this value in so开发者_开发问答me cases by assigning to it. I seem to be randomly not getting this value set even when I choose the item from the drop down. Sometimes it works and sometimes it doesn't.

Ideas?


I you are binding your data at Page_Load make sure you're not re-binding by checking if page is post back.

if(!Page.IsPostBack){ /*bind data here*/ }


Make sure you are not re-binding the data on postback before you are able to check the selection.

Also, are you creating listitems and inserting the listitem into multiple lists? If you select one list, it will change the other.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号