Verify:
One, non-null verification RequiredFieldValidator
ErrorMessage-Prompt message after verifying the error
ControlToValidate-ID of the control to validate
Display-how it is displayed. static-does not show up also occupies space. dynamic-does not show space
InitialValue-The initial value of the validation, the value of the validated control is the same as this value, is considered null
Scene:
(a) fill in the blanks
(ii) The initial value has not changed: by setting the InitialValue to achieve
Second, comparative verification CompareValidator
ErrorMessage-Prompt message after verifying the error
ControlToValidate-ID of the control to validate
Display-how it is displayed. static-does not show up also occupies space. dynamic-does not show space
ControlToCompare-The ID of the control to compare
ValueToCompare-the value to compare
Operator-Operator of contrast
Type-types of comparisons entered
Scene:
1. Compare the values of the two controls.
2. Compare the values entered by the control with the fixed values
Three, scope verification RangeValidator
ErrorMessage-Prompt message after verifying the error
ControlToValidate-ID of the control to validate
Display-how it is displayed. static-does not show up also occupies space. dynamic-does not show space
MaximumValue-Upper limit of range
MinimumValue-Lower limit of range
Type-Types
Four, regular expression validation RegularExpressionValidator
ErrorMessage-Prompt message after verifying the error
ControlToValidate-ID of the control to validate
Display-how it is displayed. static-does not show up also occupies space. dynamic-does not show space
ValidationExpression-Validation expression
V. Verification Summary ValidationSummary
ShowMessageBox-whether to display summary error messages as dialog boxes
ShowSummary-whether to display summary error messages on the page
VI. Custom validation
ErrorMessage-Prompt message after verifying the error
ControlToValidate-ID of the control to validate
Display-how it is displayed. static-does not show up also occupies space. dynamic-does not show space
ClientValidationFunction-The function name of the client-side validation function. (Do not add brackets)
Specification for client-side validation functions:
Function name (event source, event data)
{
The event data. Value-values to be given to the certificate. The value in the input box to be validated by the validation control.
The event data. IsValid--tells the validation control to verify that it passed.
}
function Zhishu (A, b) {//a-event source, B-event data
Steps
1. Take out the values to be validated.
var s = b.value;
2. Verify
var IsOK = false;
if (IsNaN (s) = = False) {//first to see if it is a number
var zc = 0;
var num = parseint (s);
for (var i = 1; I <= num; i++) {//from 1 to the value itself, divisible by each, if divisible to record zc++;
if (num% i = = 0) {
zc++;
}
}
if (ZC = = 2) {
IsOK = true;
}
else {
IsOK = false;
}
}
else {
IsOK = false;
}
3. Tell the validation control whether validation passed.
B.isvalid = IsOK;
}
Two application tips:
1. Prevent the button from firing the validation control.
By default, the Class 3 button fires validation.
If you do not want to fire validation: give the button a Causevalidation=false
2. Verify the problem with the grouping.
Set the ValidationGroup property of the input control (text box, radio, multiple selection), validation control (non-null, contrast, range, regular, custom, summary), button to the same value. They become a group.
WebForm validation Controls