Validation Controls In ASP.NET

In this article  we will learn about the diffrent types of validataion controls which are availble in asp.net framework to validates the form controls before submiting the data on server.

Presently, ASP.NET has six smart validation controls in ASP.net These controls are called smart valdiation controls because they can perform validation both on client side and server side.

The best thing is ASP.NET performs browser detection when generating the ASP.NET page and makes decisions based on the information it has.
This means that if the browser can support the JavaScript then  the validation occurs on the client-side and If the client cannot support the JavaScript means for client-side validation, this JavaScript is omitted and the validation occurs on the server.

Even if client-side validation is initiated on a page, ASP.NET still performs the server-side validation when it receives the submitted page, that  ensuring security won't be compromised.

Their are Six Server Valiadation controls in Asp.net which are as follows..
  1. RequiredFieldValidator 
  2. RangeValidator
  3. CompareValidator
  4. RegularExpressionValidator
  5. CustomValidator
  6. ValidationSummary
RequiredFieldValidator
this control is used to ensure  that the control it has to be used for  validate is not empty when the form is submitted. means suppose their is one Textbox control and you have used RequiredFieldValidator to validate that textbox then before submitting the data on server it checks the textbox is not empty.

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. means suppose their is one textbox and you wants to allow only 10 digits or any strings with specified range with help of  RangeValidator  then before submitting the data on server it make sure that value is within a specified range
 CompareValidator

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.

RegularExpressionValidator

Checks if the value of the control it has to validate matches the specified regular expression.

CustomValidator

Allows you to specify any client-side JavaScript validation  routine and its server-side counterpart to perform your own  custom validation logic .

ValidationSummary
Shows a summary with the error messages for each failed  validation's on the page or in a pop-up message box.
Summary
I hope this small introduction about the validation control is useful to all readers,In my next articles we will in detail about each control.

Post a Comment

www.CodeNirvana.in

Protected by Copyscape
Copyright © Compilemode