Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

customvalidator... or?

Status
Not open for further replies.

lin73

Programmer
Feb 17, 2006
110
SE
Hi

I have a page with severeal dropdown lists that get values from a database, and I also add a "select option" to every dropdown list. I would then like to check each dropdown list, so that the user select anything else than the first option "select option". How can I check this?


Regards
 
Custom Validator as you said.
Check if the selected index is not 0.
 
or use RequiredFieldValidator, and set the Intitial Value to the "Select Option"'s value...

Known is handfull, Unknown is worldfull
 
vbkris option of using RequiredFieldValidators is the cleanest solution. This will also do client-side validation before posting back to the server. Any time you save a round trip it's a good thing.

For the RFVs to work make sure the "select" options have a text of "select" and a value of "" (empty string). If you don't define both the RFVs will interpert the "select" option as valid.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
You can perform client-side validation with the custom validator too. This, with a simple javascript function.
 
Hi guys


Thanks for all the help, really appreciate it!


Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top