Ad

Disable ASP.NET Validators With JavaScript

- 1 answer

Does anyone know how to disable an ASP.NET validator using JavaScript? I'm using javascript style.display = 'none' to disable parts of a web page. However these disabled parts have asp.net validators that are still firing and I need to disable then without doing a round trip to the server. Thanks.

Ad

Answer

Use this snippet:

function doSomething()
{
  var myVal = document.getElementById('myValidatorClientID');
  ValidatorEnable(myVal, false); 
}
Ad
source: stackoverflow.com
Ad