Programming Tricks & Hacks

Manipulate Validator controls and Validation Group from JavaScript

Posted by kinjanshah on September 25, 2008

Today, I was working on Validator controls and there was a need to make few validator controls enabled or disabled from JavaScript. So, I was walking through it and I found below few things.

  • To enable Validator from JavaScript

ValidatorEnable(<<Validator Client ID>>, true);

  • To disable Validator from JavaScript

ValidatorEnable(<<Validator Client ID>>, false);

  • To Validate all the Validator control from JavaScript

Page_ClientValidate();

This function will return true if there is no validation error otherwise it will return false.

  • To Validate a Specific Validator Group from JavaScript

Page_ClientValidate(<<ValidationGroupName>>)

So, this way we can manipulate validator controls and validation group from JavaScript. I hope this will help you out.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>