Asp. NET validation Control one

Source: Internet
Author: User

To better create interactive Web applications and enhance application security, program developers should validate the content entered by the user.

ASP . NET provides a series of input validation controls that users can use to easily implement input validation.

ASP . NET also provides an extensible validation framework that can be used in control development, and developers can customize their validation controls by using this validation framework.

RequiredFieldValidator Controls

the function of the RequiredFieldValidator control is to specify that the user must provide information for a particular control on an ASP.

the common properties of the RequiredFieldValidator control are as follows:

ControlToValidate: binds the validation control to the control that requires validation by setting the property to the ID of a control.

ErrorMessage: Use this property to set the information that needs to be displayed when the validation control is invalid.

ValidationGroup: Binds to the group to which the validator belongs.

text: The validation control is displayed when the validation controls are invalid.

Display: This property sets the show mode for the validation control, which has three values:none indicates that no information is displayed when the validation control isinvalid , and static indicates that the placeholder for the validation control is static on the page.

cannot be for other the space occupied;

Dynamic means that the validation control is dynamic on the page and can be occupied by other spaces, and the validation control occupies the page position when validation fails.

CompareValidator Controls

the function of the CompareValidator control is to verify that the information entered in an input control satisfies pre-set conditions.

the common properties of the CompareValidator control are as follows:

ControlToValidate: binds the validation control to the control that requires validation by setting the property to the ID of a control.

ErrorMessage: Use this property to set the information that needs to be displayed when the validation control is invalid.

ValidationGroup: Binds to the group to which the validator belongs.

text: The validation control is displayed when the validation controls are invalid.

Display: This property is the setting for the validation control's show mode.

Operator: The operator used to set the comparison by this property.

ValueToCompare: Sets the data to be used for comparison.

ControlToCompare: Sets the control to be used for comparison, which is used to compare the controls controlled by the validation control to the data in other controls.

RangeValidator Controls

the function of the RangeValidator control is to verify that the user's input to a text box is within a range.

the common properties of the RangeValidator control are as follows:

ControlToValidate: binds the validation control to the control that requires validation by setting the property to the ID of a control.

ErrorMessage: Use this property to set the information that needs to be displayed when the validation control is invalid.

ValidationGroup: Binds to the group to which the validator belongs.

text: The validation control is displayed when the validation controls are invalid.

Display: This property is the setting for the validation control's show mode.

Type: Use this property to set which data type to compare.

MaximumValue: Sets the upper limit of the data range to be used for comparison.

MinimumValue: Sets the lower limit of the range of data used for comparison.

RegularExpressionValidator Controls

the function of the RegularExpressionValidator control is to verify that the data entered by the user conforms to the predefined format of the regular expression.

the common properties of the RegularExpressionValidator control are as follows:

ControlToValidate: binds the validation control to the control that requires validation by setting the property to the ID of a control.

ErrorMessage: Use this property to set the information that needs to be displayed when the validation control is invalid.

ValidationGroup: Binds to the group to which the validator belongs.

text: The validation control is displayed when the validation controls are invalid.

Display: This property is the setting for the validation control's show mode.

ValidationExpression: This property is used to set the predefined format that is described by using regular expressions.

CustomValidator Controls

the functionality of the CustomValidator control is the ability to invoke custom validation functions written by the programmer on the server side. Sometimes using existing validation controls may not meet the needs of the programmer and may require programmers to write their own validation

function, The validation function can be bound to the appropriate control by the server-side event of the CustomValidator control.

the common properties of the CustomValidator control are as follows:

ControlToValidate: binds the validation control to the control that requires validation by setting the property to the ID of a control.

ErrorMessage: Use this property to set the information that needs to be displayed when the validation control is invalid.

ValidationGroup: Binds to the group to which the validator belongs.

text: The validation control is displayed when the validation controls are invalid.

Display: This property is the setting for the validation control's show mode.

Validationemptytext: This property determines whether the bound control is empty when validation is performed, and the meaning of this property is true if the bound control is null when the validation is performed, and false means that the bound control is empty when the

Line validation.

IsValid: Gets a value that determines whether validation is passed,true means validation is passed, and false means no validation is passed.

Original link:

http://blog.csdn.net/spilledlight/article/details/48730225

Asp. NET validation Control one

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.