Code to enable/disable Validator controls of ASP.NET using JavaScript

Virendradugar
Posted by Virendradugar under JavaScript category on | Views : 6304
Sometimes, it is required to enable/disable ASP.NET Validator controls like RequiredFieldValidator, RangeValidator, CustomValidator etc.

This can be easily done via JavaScript

To Enable any validator

ValidatorEnable(document.getElementById('<%= rfvTest.ClientID %>'),true);


**rfvTest is name of the Validator control.

To Disable any validator

ValidatorEnable(document.getElementById('<%= rfvTest.ClientID %>'),false);


**rfvTest is name of the Validator control.

Enjoy...

Comments or Responses

Login to post response