Sunday, August 31, 2008

RequiredFieldValidator Control

RequiredFieldValidator Control

The RequiredFieldValidator is used to ensure that the user has placed non–white space data into a control. The other controls do not attempt to validate an empty field, so you frequently need to use the RequiredFieldValidator with one of the other controls to achieve the desired validation.
The RequiredFieldValidator provides an additional property called InitialValue that is used when the control that you are validating defaults to a value and you want to ensure that the user changes this value. For example, if you normally display a zero
(0) value in a control for the age and you want to ensure that the user changes the age, set the InitialValue to zero so a validation error occurs if the user leaves the default value of the control set to zero.

No comments: