Reading The Selected Value In DropDown List

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Do you have to use AutoPostBack to read the selected value in a dropdown
list? I have an asp.net dropdown on a form. I'm filling it from a table
when the page loads and want to read the value the user selected when they
submit the entire form. But regardless of the value they select, I always
get the first item in the list when I read it. I can get the values from
the text boxes without a problem. But the dropdown list seems to work
differently. What am I doing wrong? Thanks.

Jerry
 
Jerry,

No, you don't have to use AutoPostBack property. Rather check if you are
using IsPostBack property in the PageLoad event.

Eliyahu
 
Make sure you are not repopulating the drop down list on postback. This will
force you to get the first item in the list.
 
I had an issue today similar to this; but my issue was the the value
property for each of the list items was not unique. To keep the
selection after postback the value property MUST be unique.
 
Hey
Why dont u make use of the ViewState of the control property to reset the
selected value

Rajesh
 

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