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 automa开发者_如何转开发tic 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
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!
精彩评论