Problem with HTMLSelect.SelectedIndex and client disabled property

H

Harry Keck

I have an HTMLSelect declared with the runat=server tag and a code behind
declaration. Normally, when I cause the page to postback with a submit
button, I can test the SelectedIndex property of the HTMLSelect in my code
behind to determine its value. However, if I set the disabled property to
true from client script on the HTMLSelect before the page posts back to the
server, the SelectedIndex always returns 0 in my code behind, no matter what
value is actually selected. After the post is finished and the page
re-renders, it visibly has the correct option selected. Any subsequent
postbacks continue to show SelectedIndex set to 0 in the code behind. Even
if I change disabled to false before posting back, if I have had it set to
true at any point, I also get SelectedIndex of 0. Is this a bug or a feature
of .Net or what? Any suggestions on work arounds?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top