02 October 2011

Validation Controls

Validation is the key feture in any application dvelopement.
And when it comes to asp.net validation, there are 2 types of validations
  •   Client Side 
    •  In this type of validation, validation is been performed in client side with the help of some client side scripts like Javascript. 
    •  The Bad thing about the Client side validation is you were never quite sure if the requesting browser would understand the scripting code(usually in java script or vb script) that you used for the validation. So, it was usually better, especially for critical Web applications, to bring the validation to the server. 
  • Server Side
    • Here server side scripts are been used. 
    •  The bad thing about server-side validation is that it requires trips back and forth to the server. This takes a lot of resources and makes for a slower-paced form for the user.

Asp.net Validation Server Controls
  • These are the controls provided by Microsoft which provides both client and server side validation and thus used for validating user input. 
  • If we are using such controls for validation, then its not we who decide whether to perform client side or server side validation, its Asp.net engine(depending on the browser which made the request),which indicates your page's functionality varies depending on the requesting browser. 
  •  Here is a list of the validation controls 
    • RequiredFieldValidator 
      The RequiredFieldValidator control is used to ensures that a input field is not skipped in the entry. The control fails validation if the value it contains does not change from its initial value when validation is performed. If all the fields in the page are valid, the page is valid.
    • RegularExpressionValidator
      The RegularExpressionValidator control confirms that the entry matches a pattern(let say \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* which is for email address) defined by a regular expression.
    • RangeValidator
      The RangeValidator control tests whether an input value falls within a given range.
    • CompareValidator
      The CompareValidator control compares the value of one control to another, or to an explicit value in the control's ValueToCompare property,Even we can use this for Datatype Validation(like we have to enusre that user can eneter only integer values).
    • CustomValidator
      The customvalidator control allows writing custom validation for a control. So, if the others validators are not useful for a specific validation, it is possible to write server side validation function or a client side validation function.
    • ValidationSummary
      A ValidationSummary control is displayed when Page validation fails. It "polls" each of the validation controls on the page and aggregates the text messages exposed by each.
Reference links

Hope it helped,will post in detail,how to use this controls in future posts.
Thanks,Happy programming, awaiting for comments

No comments:

Post a Comment

Your comments, Feedbacks and Suggestions are very much valuable to me :)

Things are upgraded

My Dear readers, I am really thankful for being supportive all these years. This site was the first blog site I ever created in my life...