Types of ASP.Net validation controls?
ASP.NET validation controls allow you to check user input on a web page. There are controls for different types of validation, such as range checking or pattern matching. Each validation control references an input control (a server control) elsewhere on the page. When user input is being processed (for example, when a page is submitted), the validation control tests the user input and sets a property to indicate whether the entry passed the test. After all of the validation controls have been called, a property on the page is set indicating whether any validation check has failed.
You can test the state of the page and of individual controls in your own code. For example, you would test the state of the validation controls before updating a data record with information entered by the user. If you detect an invalid state, you bypass the update. Typically, if any validation checks fail, you skip all of your own processing and return the page to the user. Validation controls that detect errors then produce an error message that appears on the page. You can display all validation errors in one place using a ValidationSummary control.
ASP.NET validation controls
1). CompareValidator control:
The CompareValidator control compares a user's entry against a constant value, against the value of another control(using a comparison operator such as less than, equal, or greater than), or for a specific data type.
2). CustomValidator control:
The CustomValidator control checks the user's entry using validation logic that you write yourself.
3). RangeValidator control:
The RangeValidator control checks that a user's entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates.
4). RegularExpressionValidator control:
The RegularExpressionValidator control checks that the entry matches a pattern defined by a regular expression. This type of validation enables you to check for predictable sequences of characters, such as those in e-mail addresses, telephone numbers, postal codes, and so on.
5). RequiredFieldValidator control:
The RequiredFieldValidator control ensures that the user does not skip an entry.
6). ValidationSummary control:
The ValidationSummary control does not perform validation, but is often used in conjunction with other validation controls to display the error messages from all the validation controls on the page together.
If you enjoyed this post, please like (or) share this article.