i

ASP.Net A Complete Guide

Validation Controls

As the name suggests, validation control's main purpose is to validate. Validation means to check if given input is as per the rule applied on that particular control.

Validation control displays the error message if the given input is not as per the rule applied on the control.

Below table shows the different types of validator control:

RequiredFieldValidation:

For the given control input is mandatory. Ex

CompareValidator:

This validator compares one control input with another control input.Ex

RangeValidator:

Verify that the user entered the input is in between two values that are between "minimum value" and "maximum value".

RegularExpressionValidator:

Input must match with a specified pattern.

ValidationSummary:

 Display all the failed validation on a single action. Like:- submit button. Both Error Message and Text properties are used to display error messages. The text error message has precedence.

CustomValidator:

There are chances that whatever the validation provided by the asp.net is actually not sufficient to solve the purpose, then, in that case, we can write the custom validation as well.