October 2010
Intermediate to advanced
1920 pages
73h 55m
English
LengthValidator ControlTo illustrate the general technique for creating a custom validation control, in this section we create an extremely simple one. It’s a LengthValidator control, which enables you to validate the length of a form field.
The code for the LengthValidator control is contained in Listing 3.20.
Listing 3.20. LengthValidator.cs

Listing 3.20 contains a class that inherits from the BaseValidator class. The new class overrides the EvaluateIsValid method. The value from the control being validated is retrieved with the help of the GetControlValidationValue() method, and the length of the value is compared against the ...