Continuing learning of Validator controls

xiaoxiao2021-03-06  104

Validator's continuation learning 1) RequiredFieldValidator - Detecting whether there is an input content in the object control: ControlToValidate ErrorMessage Display Addition Properties: InitialValue Description: RequiredFieldValidator's properties can be said to be the simplest of several validation space, and he The three attributes must be available in each verification control below. There are: controlTovAlidate is used to match the validated control, and errorMessage is used to display the error message, and Display is the displayed mode, which is None, Static, Dynamic three properties. NONE indicates that no information is output on the page when an error message appears; static means that he always uses a quick place pretension to display an error message, Dynamic is the most human, and choosing his result is only an error message will only appear. Tips, generally only choose this. Finally, due to ControlTovAlidate, ERRORMESSAGE, Display These attributes must be of each verification control, so I will no longer mention them when other controls will be introduced. InitialValue can set an initial value in RequiredFieldValidator to determine if the user changes the value, if the value is the same as the value, then an error message is generated. Example: * the control achieved One verification, if the information submitted in txtName is null or JACK (the retention value of any programmer) is generated. The * indicates information directly on the page when the error is in the error.

2) CompareValidator - compares the value of the control: ControlToCompare Operator Description: ControlToCompare is the name of the object compared to the specified object. Operator is the operation method, mainly equal to, not equal, greater than, less than, etc., the default is equal to. Personally think that these values ​​are not significant because his comparisons that are less than less than, can be constrained by the RangeValidator described below.

3) RangevaliDator - The boundary decision main attribute: minimumValue maximumValue Description: It can be seen in a glance, the maximum minimum, the minimum, no longer repeat.

4) RegularExpressionValidator - Compare the submitted content and matching rules. Main attributes: ValidationExpression Description: Compares as follows: [] In this is the definition rule. [0-9a-za-z] represents any character from the number 0-9, English case, can match. [^] A reverse number, indicating that the characters in [] can match {} indicate the number of input characters, the rules are {A, B} indicates that from the A-B characters can be accepted. Little origin, indicating any character / backslash, for outputting special characters, such as small origin, parentheses, etc., etc. repeated. 5) CustomValidator - Custom function to verify the verification process, there is no experience. 6) Validationsummary - is used to come to the top of the page to display. Directly output the label, displayed is a red  Example:

At this point, learn about the Validator control to a paragraph.

转载请注明原文地址:https://www.9cbs.com/read-104765.html

New Post(0)