Monday, 5 September 2011

Validation Controls in Asp.Net

ASP.NET offers a series of predefined validation controls:
  • RequiredFieldValidator: You can specify that a user must provide information in a specific control on an ASP.NET web page by adding a RequiredFieldValidator control to the page, and linking it to the required control. For example, you can specify that users must fill in a Name text box before they can submit a registration form.
  • CompareValidator: 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. Supported data types are: Integer, Currency, Double, Date, and String.
  • RangeValidator: 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.
  • RegularExpressionValidator: 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 email addresses, telephone numbers, postal codes, and so on.
  • CustomValidator: Checks the user’s entry using validation logic that you write yourself. This type of validation enables you to check for values derived at run time.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home