Dropdownlist whoas

  • Thread starter Thread starter Kent Ogletree
  • Start date Start date
K

Kent Ogletree

I do not know why this is being such a problem to me today, hopefully
someone can help me figure out where I am going wrong.

Simple DropDownList that is populated from a arraylist. Current setting of
the item is set to selected, otehr items are possible other settings. When I
select a different value for the setting, autopost back is fired and
SelectedIndexChangeEvent is called. HOWEVER for some reason the
SelectedItem.Value and SelectedValue properties are that of the original
data item, not the one that was just selected. I can not seem to find the
newly selected value anywhere.

So where can I find the newly selected Item?

TIA,
Kent
 
Kent,

Did you serialize your arraylist, put it in a session and deserialized it in
the load event again from that at IsPostback.

Using a datast is easier by the way, that you don't have to
serialize/deserialize

I hope this helps,

Cor
 
Thanks Cor,

The issue was actually simpler than that in the fact I had missed checking
IsPostBack in the Page_Load event. Which meant the drop down was repopulated
prior to my checking for the SelectedValue. I just knew I was missing
something really simple.

Thanks,
Kent
 
It's because you are re-binding on postback and therefore loose your
viewstate

If Not IsPostback

DataBind

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top