You are on page 1of 2

ASP.

NET Validation Controls


Presently, ASP.NET has six smart validation controls in .NET 3.5. These controls are called smart valdiation controls because they can perform validation both on client side and server side. ASP.NET performs bro ser detection hen !eneratin! the ASP.NET pa!e and ma"es decisions based on the information it !leans. This means that if the bro ser can support the #avaScript that ASP.NET can send its ay, the validation occurs on the client$side. %f the client cannot support the #avaScript meant for client$side validation, this #avaScript is omitted and the validation occurs on the server. Even if client$side validation is initiated on a pa!e, ASP.NET still performs the server$side validation hen it receives the submitted pa!e, thereby ensurin! security on&t be compromised. The available validation server controls are Validation Control Description RequiredFieldValidator RangeValidator Checks that the value of the associated control is within a specified range. The value and the range can be numerical, a date or a string. Checks that the value of the associated control matches a specified comparison less than, greater than, and so on! against another constant value or control. Checks if the value of the control it has to validate matches the specified regular e#pression. $llows you to specify any client%side &ava'cript validation routine and its server%side counterpart to perform your own custom validation logic. 'hows a summary with the error messages for each failed validator on the page or in a pop%up message bo#!.

Checks that the control it has to validate is not empty when the form is submitted.

CompareValidator Regular"#pressionValidator CustomValidator Validation'ummary

The BaseValidator Class


The validation control classes are found in the System.'eb.(%.'eb)ontrols namespace and inherit from the *ase+alidator class. This class defines the basic functionality for a validation control.

You might also like