Continuing learning of validator controls

Source: Internet
Author: User
Tags comparison
Control Validator Continuing Learning
1) requiredfieldvalidator--detect whether there is input in the object control
The main properties are:
ControlToValidate
ErrorMessage
Display
Additional properties:
InitialValue
Description
The RequiredFieldValidator attribute value can be said to be the simplest of several verification spaces, and his three attributes are required for each of the following validation controls. There are: ControlToValidate used to match the validated control, errormessage to display the error message, display is the displayed mode, respectively, there are none,static,dynamic three of properties. None indicates that no information is printed on the page at the time of the error; Static indicates that he always occupies a quick place on the page ready to display the error message, dynamic Most human, select his result is only when the error message will appear prompts, generally only select this. Finally, since the three properties of ControlToValidate, ErrorMessage, and display are required for each validation control, I will no longer mention them in the introduction of other controls in the following introductions.
InitialValue can set an initial value in RequiredFieldValidator to determine whether the user has changed the value and generates an error message if the user submits the same value as the value. Cases:
<asp:requiredfieldvalidator id= "Reqval1" runat= "Server"
Controltovalidate= "Txtname"
Errormessage= "Please input your name"
Display= "Dynamic"
Initialvalue= "Jack" >
*
<asp:RequiredFieldValidator>
The control implements one validation and generates an error message if the information submitted in txtname is null or is Jack (a reserved value that can be for any programmer). The * between the tags represents the actual information directly on the page at the time of the error.

2) comparevalidator--The value of the control to compare
Main properties:
ControlToCompare
Operator
Description
ControlToCompare the name of the object to compare with the specified object. Operator is the operation method, the main is equal to, not equal to, greater than, less than, the default value is equal to. Personally, the value of these values is not significant, since his comparison of greater than less than is possible by the RangeValidator described below.

3) rangevalidator--Limit determination
Main properties:
MinimumValue
MaximumValue
Description
You can see at a glance that the maximum minimum value is no longer classified.

4) regularexpressionvalidator--The content of the submission to match the rules of comparison.
Main properties:
ValidationExpression
Description
The comparison is as follows:
[] Here is the definition of the rule. [0-9a-za-z] indicates that any character in the English case can be matched from the number 0-9.
[^] counter, which means that the characters in addition to [] can match
{} indicates the number of input characters, the rule is {a,b} that can be accepted from A-b characters
。 A small origin that represents any character.
\ backslash, for output special characters, such as Dot origin, parentheses, etc.
A little bit of experience with matching rules (the use of caret in character Fu) was mentioned yesterday and will not be repeated today.

5 customvalidator--The Custom function to verify the processing, temporarily does not have any experience.
6) validationsummary--is used to display the top of the page. directly to the label output can be, the display is red?
Example:
<asp:validationsummary id= "valsum" runat= "Server" ></asp:ValidationSummary>

To this, learn about the validator control to a paragraph.



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.