Overview of ASP.NET Validation
You can use the validation controls to check whether a user has entered proper values into form fields. If the user hasn't then you can display an error message.
The ASP.NET 2.0 Framework includes the following validation controls:
RequiredFieldValidator - Enables you to require that a user provide a value for a form field.
RangeValidator - Enables you to check whether the value of a form field falls between a specified minimum and maximum value.
CompareValidator - Enables you to compare the value of one form field against another form field or fixed value. Also, enables you to check the data type of a form field.
RegularExpressionValidator - Enables you to compare the value of a form field against a string pattern represented by a regular expression.
CustomValidator - Enables you to use a custom method to validate the value of a form field.
ValidationSummary - Enables you to display a summary of validation errors.
All of the validation controls, except the RequiredFieldValidator, do not require a user to enter a value. For example, you can use the CompareValidator to check whether a user has entered a birthdate that is a valid date without requiring the user to enter a value.
You can associate more than one validation control with the control being validated. For example, you can associate both a RequiredFieldValidator and a CompareValidator with a birthdate form field.
All of the validation controls support client-side JavaScript but "fall back" to server-side validation. If you are using a recent version of Internet Explorer, Firefox, or Opera then validation occurs on the client before the page is posted back to the server (data is also validated on the server for security reasons). In the case of older browsers (old versions of Netscape), validation only takes place on the server-side.