DropDownList and AutoPostback -- default item

N

Null

Hello --

Is there a way to prevent the autopostback of a drop down list if there is a
"default" item in the list -- example, a drop down list where the first item
says "Select One" and the remaining items are all values available for
selection....if the user changes the selection I want to postback, unless
they are selecting the default item. Is there a way to do this using
autopostback? Or should I just use client side script and force a
form-submit when the value is changed?

Any tips or suggestions?

Thanks in advance!
 
S

S. Justin Gengo

Null,

You could use a required field validator. Set its "ControlToValidate"
property to true and set its "InitialValue" to "Select One" (no quotes).
This would keep the drop down from posting back unless the selection is
something other than "Select One".

The only problem with the above method is that if there are form fields for
submission the form won't submit unless a user selects a value from your
drop down first. If you need them to select one no matter what then this is
the best solution.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 

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,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top