What Are The Different Types Of Validators (Controls) In ASP.NET ?
Answer
The different types of validator controls in asp.net are…
- RequiredFieldValidator Control
- RangeValidator Control
- CompareValidator Control
- RegularExpressionValidator Control
- CustomValidator Control
Can you briefly tell me what each of these controls help you achieve?
Sure.
- RequiredFieldValidator Control can be used to make sure that the user enters something into the field that it is associated with in the form.
- RangeValidator Control compares what is entered into a form field with two values and makes sure that what was entered by the user lies in between these two specified values.
- CompareValidator Control compares the value entered into the form field to another field, a database value, or any other value that you specify.
- RegularExpressionValidator Control is a validation control that enables you to check the user’s input based on a pattern defined by a regular expression. This is commonly used to validate email addresses, zipcodes and other such data items.
- CustomValidator Control enables you to develop your own custom server-side or client-side validations if all the above don’t work for you.
