dropdownlist does not retain its selectedindex value on postback.

J

John Blair

Hi,

I have a dropdownlist in a grid header template - i have autopostback on but
when i check the selectedindex in the page_load event (i have a routine
which identifies the control that caused the postback and it determines the
dropdownlist correctly) it is always 0 - i am NOT rebinding to the
dropdownlist in the page_load event i.e. only once if !postback. I also have
viewstate set to true for the control and the grid it is in! The grid is
embedded in a nested set of html tables. Any idea why the selected index is
not retained..and also when the page is redisplayed after the postback the
dropdownlist is reset to the first item in the dropdownlist?

Thanks for any help!

Any ideas?
 
L

Lucas Tam

I have a dropdownlist in a grid header template - i have autopostback
on but when i check the selectedindex in the page_load event (i have a
routine which identifies the control that caused the postback and it
determines the dropdownlist correctly) it is always 0

Do you by any chance have a SelectedIndexChanged handler? That is where the
SelectedIndex gets updated.
 
J

John Blair

Hi,

Thanks for the feedback.
I found out the cause of my situation - my grid is in a web page that also
includes an XML control - that thru XSLT generates a variety
of <Form></form> tags that when embedded in the main page <form> tag causes
the selections to go amiss - removed the XML control and all worked
perfectly!

Thanks.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top