Asp.net 6 control verification methods

Source: Internet
Author: User

1. required verification control requiredfieldvalidator

Syntax Rules: <asp Tutorial: requiredfieldvalidator

Id = "identifier"

Runat = "server"
Controltovalidate = "control identifier to be verified"

Errormessage = "error message">

</Asp: requiredfieldvalidator>

This control often verifies textbox, and is blank in response.

2. Range verification control rangevalidator

Syntax rule: <asp: rangevalidator

Id = "identifier"

Runat = "server"

Controltovalidate = "control identifier to be verified"
Errormessage = "error message"

Maximumvalue = "maximum"

Minimumvalue = "minimum"

Type = "compare value type">

</Asp: rangevalidator>

This control is often used to verify that the age and so on represent a range. Note that if no information is entered, the range-eye verification control will not perform verification.

3. Regular Expression verification control

Syntax Rules: <asp: regularexpressionvalidator

Id = "identifier"

Runat = "server"
Controltovalidate = "control identifier to be verified"

Errormessage = "error message"
Validationexpression = "Regular Expression">

</Asp: regularexpressionvalidator>

This control uses regular expressions for verification. The rules for regular expressions are complex. Next time I will write an article about this control. Common regular expressions are provided in vs2008.

4. Comparison and verification controls

Syntax Rules: <asp: comparevalidator

Id = "identifier"

Runat = "server"
Controltocompare = "control identifier to be compared"

Controltovalidate = "control identifier to be verified"

Errormessage = "error message"

Opterater = "comparison type">

</Asp: comparevalidator>

This control is used to compare whether the two passwords are the same.

5. Custom verification controls

Syntax rule: <asp: customvalidator

Id = "identifier"

Runat = "server"
Controltovalidate = "control identifier to be verified"

Errormessage = "error message"
Onservervalidate = "Verification Method">

</Asp: customvalidator>

This control is used to customize the methods to be verified.

6. Verify the total number of controls

Syntax Rules: <asp: validationsummary

Id = "identifier"

Runat = "server"
Displaymode = "display mode"

Headertext = "title"

Showmessagebox = "true/false" whether to bring up a window/>

This control aggregates error messages when many verification controls exist.

In the asp.net tutorial, there are six types of verification controls: mandatory verification controls, range verification controls, regular expression verification controls, comparison verification controls, user-defined verification controls, and total verification controls.

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.