DropDownList.SelectedValue is incorrect!

J

jeffmagill

I have an asp:dropdownlist in a form that is loaded with records from a

database. Upon clicking a button, a subroutine SubmitHandler is called.

The problem is that no matter which entry in the dropdownlist is
selected when the form is submitted, the value that I am recieving in
the subroutine SubmitHandler is always the first item in the
dropdownlist.

I vaguely remember someone mentioning something about
dropdownlist.selectedvalue not working properly when its contents are
sorted. Upon hearing this, I realized that this problem occurs when I
include an "ORDER BY" clause in my SQL statement - after removing the
"ORDER BY" clause everything works fine again. Unfortunately I need to
keep them ordered. I dont know. Im stumped.

Does anyone know what is wrong? Thanks in advance.

Jeff
 
J

jeffmagill

nevermind, i didnt notice that for this particular list, i was loading
it without checking for Not IsPostBack().

the wierdest part was that everything worked fine if the data was
sorted.
 

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,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top