简体   繁体   中英

Change CSS class of validated control?

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM