What is Validation Control in ASP.NET?

Define Validation Control in ASP.NET.

- The validation control is used to implement page level validity of data entered in the server controls.

- This check is done before the page is posted back to the server, thus avoid a round trip to the server.

- If the data does not pass validation, it will display an error message to the user.

- It is an important part of any web application.

There are two types of validation:

1. Client side
2. Server side

- Validation controls are mostly used for implementing presentation logic, to validate user input data, data format, data type and data range.

- Client side validation is good, but we have to be dependent on the browser and scripting language support.

- Server validation will work always whether client validation is executed or not.

Following are the six types of validation control:

Sr. No.Validation controlDescription
1.RequiredFieldValidation ControlIt makes an input control a required field.
2.CompareValidator ControlIt compares the value of one input control to the value of another input control or to a fixed value.
3.RangeValidator ControlIt checks that the user enters a value that falls between two values.
4.RegularExpressionValidator ControlIt ensures that the value of an input control matches a specified pattern.
5.CustomValidator ControlIt allows you to write a method to handle the validation of the value entered.
6.ValidationSummaryIt displays a report of all validation errors occurred in a web page.
Validation types supported by ASP.NET
ASP.NET - Validation types supported by ASP.NET - The RequiredFieldValidator control forces the input control a required field....
Steps to use Validation Control - ASP.NET
ASP.NET - Steps to use Validation Control - Draw a validation control on a Web form...
Types of validation controls are provided by ASP.NET
ASP.NET - Types of validation controls - 5 Types of validation control exists:...
Post your comment