Imp Points on Asp.net Validation Controls


There are 6 Validations Control in ASP.net
·         Required Field Validator

·         Compare Validator

·         Custom Validator

·         Range Validator

·         Regular Expression Validator

·         Validation Summary

·         Required Field Validator: Makes an input control a compulsory field.

·         Compare Validator: Compares the value of one input control to value of another input control.

·         Custom Validator: Custom Validation to write a method to handle the validation of the value entered.

·         Range Validator: Checks that the user enters a value that is between two values range.

·         Regular Expression Validator: A specific format value of an input control matches a specified pattern.

·         Validation Summary: Displays a report of all validation errors occurred in a Web page.

There are some Imp points to remember while we are going to apply Validation controls to our c
ontrols:
·         Use Page.IsValid before submitting data from page. It checks the validation after submitting the form if JavaScript does not support our browser.
·         There are three display property to show our validation output i.e. None, Static and Dynamic.
·         To Prevent the validation from other button use CauseValidation=”False”. I.e. from Cancel Button you can set property CauseValidation False.
·         Use Initial Value property to check initial Value i.e. in drop down We set the default value 0 which should not be insert into our Database. So we can set Initial Value of the DropDown to 0.
·         Regular Expression Validator is used to check for string pattern i.e. Zip Code, Email ID etc.
·         Validations Control provides both side validations (Server and Client), You can disable Client Side Validation to Set the EnableClientScript to False.
·         Using Compare Filed Validator you can validate from one input control to another i.e. Password match, Date Format etc.
·         If you want to validate two Groups of validations then you need to set Validation Group Property. I.e. if you have two different registration forms and applied the validation on both, then you can set one Validation Group name and other with different name.
·         Validation Summary is to use to show all error messages to display at once.
·         You can set SetFocusOnError Property when there are some error occurred while filling in controls.

Comments