Disable all Validator elements on the page.

In the early stages of the dev cycle, it is a little annoying to have all the validations check by applying their rules if we just want to move quickly from form to form.

What's the easiest way to disable all validation elements on a page?

+2


source to share


5 answers


Set up javascript to get all validation elements in your page and set them to false in a for loop, something like this will work



function DisablePageValidators()
{   
 if ((typeof(Page_Validators) != "undefined") && (Page_Validators != null)) 
  {
    var i;
    for (i = 0; i < Page_Validators.length; i++) {
        ValidatorEnable(Page_Validators[i], false);
    }
  }
}

      

+4


source


Try the following:



Page_ValidationActive = false;

+2


source


Your best bet is to recursively iterate over all the controls on the page, looking for all controls that inherit from the BaseValidator class , and then set the property to a Enabled

value False

. You can write this as a simple library method.

+1


source


If you are allowed to enter garbage data, maybe it would be easier to hack quickly so that you just skip the page you wanted to be in first place instead of messing around with validation?

0


source


Remove them from the page.

0


source







All Articles