Regularexpressionvalidator:: Validation Controls
Regularexpressionvalidator:: Validation Controls
Regularexpressionvalidator:: Validation Controls
RequiredFieldValidator::
Checks that the validated control contains a value. It
cannot be empty. The most important property in the
RequiredFieldValidator is InitialValue.
Properties
controlToValidate="txtName"
errorMessage="Name must be entered"
RegularExpressionValidator:
Checks the value against a regular expression (pattern).
Checks that the value in the control matches a specified
regular expression. The most important property in the
RegularExpressionValidator is
ValidationExpression.
Properties
controlToValidate="txtH"
errorMessage="Hours must be
1-3 digits only"
validationExpression="\d{1,
3}">
CompareValidator:
Checks if the value is acceptable compared to a given
value or compared to the content of another control. The
most important properties in the CompareValidator are
ValueToCompare, ControlToCompare, Operator, and
type.
Properties
controlToValidate="txtR"
ControlToCompare=”txts”
errorMessage="Rate must be numeric"
RangeValidator:
Checks if the input control’s value is within a specified
range. The most important properties in the
RangeValidator are MaximumValue, MinimumValue, and
type.
Properties
controlToValidate="txtDependents"
MaximumValue=10
MinimumValue=0
errorMessage="Must be from 0 to 10"
CustomValidator:
Performs user-defined validation on an input control
using a specified function (client-side, server-side, or
both). The most important property in the
CustomValidator is ClientValidationFunction.
Properties
controlToValidate="txtDeptNum"
onServerValidate="validateDeptNum"
errorMessage="Must be in multiples of 10"
ValidationSummary:
Displays a summary of all current validation errors. In other
words, reports a summary of all errors. The most important
properties in the ValidationSummary are DisplayMode,
ShowHeaderText, ShowMessageBox, and ShowSummary.
Properties
headerText="Please correct the following
errors"
showSummary= "True"