views:

106

answers:

2

I've an ASP.NET dropdown list and getting selected value by using the .SelectedValue. I also set this value in some 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?

A: 

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*/ }
HasanGursoy
@Hasan Thanks. I think I figured it out and it was something quite a bit more complex but only related to my project. Thanks for answer though.
Curtis White
+1  A: 

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.

senloe