asp.net Data validation control _ Practical Tips

Source: Internet
Author: User

1, non-null data validation control Requiredfiledvalidator.

Properties: Controltovaliata refers to which control the validation control validates. For example, verify that the ID property of the TextBox control Txtpwd, as long as the requiredfiledvalidator. The Controltovalidata property of the control is set to Txtpwd. Code: this. Requiredfiledvalidator1.controltovalidata= "Txtpwd";

ErrorMessage property: Used to specify the error message text that is displayed when the Requiredfiledvalidator control is used in a page. Code: this. Requeiredfiledvalidator1.errormessage= "*";

2. Data Comparison validation control

CompareValidator:

Important property: ControlToCompare Specifies the control ID for which you want to compare values. For example, verify two-time IDs.

This.comparevalidator1.controltocompare= "Txtpwd";

This.comparevalidator1.controltovalidate= "" Txtrepwd:

Operator property: The action that is performed when validation occurs. For example, verify that the input password and re-enter the password are consistent.

this.comparevalidator1.operator=validationcompareoperator.equal;

Type property: Specifies the data type of the two values to be compared, such as verifying the data type of both

This ..... type=validationdatatype.string;

ValueToCompare Property: Specifies the value to compare.

 <title> Data validation Technology </title>  

3. Data type validation control

CompareValidator validates the user's input against a specific data type to ensure that the user enters a number or a date.

Example: The control properties used, Cotroltovalidator, operator, type properties. Verify that the birth date entered by the user matches the type.

A demonstration of the fading effect of jquery.

<! DOCTYPE html>  

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.