Use JavaScript to trigger ASP. NET validator Verification

Source: Internet
Author: User

Generally, ASP. NET validator is automatically verified when the page is submit. But sometimes we want to manually trigger it. You can use the followingCode: Validatorvalidate (_ validator); among them, validatorvalidate is a function contained in the script carried by the validator control.
What if I want to trigger all the tasks at a time? Available
For (VAR I = 0; I <page_validators.length; I ++)
{
Validatorvalidate (page_validators [I]);
}

Page_validators is an array object. pages containing the validator control automatically save all the validator controls to this object.

 

For example:
You only need to get the validator through the ID.
Validatorvalidate (document. getelementbyid ("validator1 "));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.