Validation Controls in visual studio
In this resource i define the working of all six Validation Control of website application with an example. Example has a form of login type. All the validation controls are used upon the text box. validation controls are used on login form because many user not enter there name, or enter unmatched passwore etc.
A Validation control is used to validate the data on a web page within a input control. If the data does not pass the validation defined in the validation control, it will display an error message in the valiadtion summary or in front of input control, wherever you decided.
with this Resource i am also uploading a project which has all six validation controls. validation controls are the controls for validate a text field like text is not empty, text in text box should in range.
six validation controls are:
1.
- used if you not want a text field empty.RequireFieldValidator
It forces the user to input a value in the field. User can not post the page to server with empty value.
2.
- for setting range for the text box.RangeVliadator
It forces the user to input value in a range defined in the input control. you can not enter a value greater or lower then range.
3.
- that email enter in text is valid or not(etc.).RegularExpressionValidator
It enforces a pattern to the input control. you must have to write text in the pattern specified.
4.
- for comparing value of two text.CompareValidator
It compare values of two input control like password. if values in password and repeat password is mismatch, then you are not able to save.
5.
- this used for security code checker.CustomValidator
It allows you to write a method for comparison. you write your custom method according to your need.
6.
- this is used for giving a summary of all the errors by validation control you used.ValidatioSummary
It displays all the validation occurs in the page in a single place.
I also give a text file in my upload which shows how we use these six controls. There is a general problem in validation control that if you have two buttons in a page with validation control than both buttons actives the validation control. to over come from this problem you use a property named ValidationGroup, by right clicking on any button or validation control go to properties and you see that property.
then simply named the groups anything you want. this group activate only when its member activate it.
hope it helps.
///regards
SAURABH TYAGI