DropDownList and AutoPostback -- default item

  • Thread starter Thread starter Null
  • Start date Start date
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!
 
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
 
Back
Top