Today, I started carefully studying the Validator control, I got the following experience:
1. With regard to the use of RegularExpressionValidator controls, because I started to use this control to perform Email authentication, first use this feature. I started to enter: [A-ZA-Z0-9] @ [A-ZA-Z0-9] {1,}, but verification is always pass, prompts if there is a mistake until I entered X @ x (or X @ * - * represents the format of any character within I specified). Understand, it turns out in each [], it must be judged after each [], and then the following [A-ZA-Z0-9] {1,} @ [A-ZA-Z0-9] {1,}, successfully passed the verification . Later, find information, discovery. {1,} @. {1,} is more convenient (. Representative arbitrary characters)
2. About the use of ERRORMESSAGE properties. The error he prompt does not display directly in the page, but passes the value of this property to Validationsummary. Then, the output of the page is then performed by validationsummary.
Regarding the type of the Validator control (there are 5 kinds of validation, there is also a collection of validation results):
1. RequiredFieldValidator - Used to check if you have entered content within the verification control, if not, an error message is generated.
2. CompareValidator - The input information is compared to existing information. If the result is false, an error is generated.
3. RangeValidator - Used to check the input information range.
4. RegularExpressionValidator - is used to check if the input is compliant with a rule expression.
5. CustomValidator - For developers custom verification controls.
6. Validationsummary - is used to collect and display the page verification results.