ddPersonList.SelectedValue gave me the valuefield of the selected item (autopostbackflags is set to on). Since upgrading to 10.1 i get a null reference exeption.
When stepping the code ddpersonlist.SelectedItemIndex gave me 358 (correct) but still the selectedvalue is null reference.
What happened? Help (quick!) is appreciated!
Thank you for your reply.
SelectedItemIndex only gives me the index... I need the value of the item chosen, the index does me no good really. With or without the DataBind() (and removing the if postpack line), I get the same results. I get a correct value for SelectedItemIndex but SelectedValue gives me a null reference error.
Hello Lisa,
I've researched your sample. In order to overcome this issue I would suggest provide a datasource on each postback without databind. the WebDropDown control does not keep its data items in viewstate and this requires datasource to be provided on each postback. To invoke dataBind() is not needed at all. I see in your code that you bind the WebDropDown on firs postback only and then if not postback you are trying to access a value form webdropdown item. which is not there since datasoruce is not provided . You can use ItemSelectedIndex to determine which item has been selected on previous round-trip to the client like this:
ddPersonList.SelectedItemIndex
Hope this helps you.
Let me know if you have any questions.
Can anyone help? I'm totally stuck and getting frustrated.
attaching the code files.
Hi,
I cannot determine what's the cause of this issue without looking at some code (ASPX + code behind). That would help me a lot in resolving it.
Thank you,
Angel