Link to home
Start Free TrialLog in
Avatar of Member_2_1316035
Member_2_1316035

asked on

RequiredFieldValidator on dropdownlist

How can I force web users to explicitly select an option on the dropdowlist?  By default, dropdownlist selects the one appears.  It makes RequiredFieldValidator on dropdownlist useless.  

Do I miss something about the Validator?  If I can not make the validator to work,  I can do dynimic validation on the server side but I don't know the best practice to do client validation.

Please help.

Biang
Avatar of praneetha
praneetha

i guess since something is allready selected...it won't fire the required field validator...

you can instead write javascript to check if the dropdownlist index chnaged
Avatar of Member_2_1316035

ASKER

I am inspired by this article in google.  Use CompareValidator with NotEqual to the default selected value.

http://www.google.com/groups?q=requiredfieldvalidator,+dropdownlist&hl=en&lr=&ie=UTF-8&selm=%23pCp6gYgBHA.1640%40tkmsftngp07&rnum=10
yep that's a good idea..thank u for sharing
ASKER CERTIFIED SOLUTION
Avatar of praneetha
praneetha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe ASP.NET should have designed RequiredFieldValidator to handle this normal scenario.  Thank you  praneetha for finding it out.  I think th trick here is the setting of InitialValue.  Well done!
thank u and you are welcome..i learnt something new too...

have a good weekend