views:

126

answers:

1

Hi

Is it possible to change the CSS class of the validated control if it's not valid without codebehind or just with less code ex. Set automatic CSS class to "invalid" of all textboxes which have a required field validator?...

I don't like to make a check for each validator (isvalid) I have, manually.

Thank you and best regards

+1  A: 

What you need is client side validation.

JQuery is perfect for that. you can use this nice tutorial: http://www.webreference.com/programming/javascript/jquery/form_validation/

or use a plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/

one way or another - no need to run to the server and back, and you have full control of the validation process and its outcomes (so you can change the css accordingly)

Enjoy!

yn2
Thank you I will try. I hoped I can override anything to make automatic by the default asp validation check
snarebold