CustomValidator control is used to validate a input control with user-defined function either from server side or client side.
Generally this control is used when you feel that no other validation controls fit in your requirement.
Following are main properties of the validation control.
ClientValidationFunction |
Gets or sets the validation function that will be used in client side (JavaScript function).
|
OnServerValidate |
Method that fires after post back.
|
ControlToCompare |
Gets or sets the ID of the control whose value will be compared with the currently entered value.
|
Operator |
DataTypeCheck/Equal/GreaterThan/GreaterThanEqual/LessThan/LessThanEqual/NotEqual.
Used to specify the comparison operation to peform. In case of DataTypeCheck, ControlToCompare properties are ingnored.
|
Display |
Dynamic/Static. Used to indicate how the area of error message will be allocated.
Dynamic: Error message area will only be allocated when error will be displayed. Static: Error messagea area will be allocated in either case.
|
Enabled |
true/false. Gets or sets whether to enable the validation control or not.
|
ErrorMessage |
Gets or sets the text of the error message that will be displayed when validation fails (This is displayed when ValidationSummary validatoin control is used.).
|
Text |
Gets or sets the description of the error message text.
|
ValidationGroup |
Gets or sets the validation group it belongs to. This is used to group a set of controls.
|
SetFocusOnError |
true/false. Used to move focus on the control that fails the validation.
|