Freelance Jobs

Validator's In ASP.NET 4.0

Validators in ASP.NET 4.0

Introduction:-
In asp.net we have numbers of validators with the help of it we can validate our data before it send to the server side. Thanks to Microsoft that provide validators for validing various tasks and reduce to write the javascript code that are used in earlier.

Now i would like to tell you about types of validators.

There are 6 types of validators that are provided by ASP.NET 4.0 :-

1) Required Field Validator
2) Compare Validator
3) Range Validator
4) Regular Expression Validator
5) Custom Validator
6) Validation Summary


Now talk about the tasks or work that each validator perform to fulfil our needs.

NOTE :- You must associate validator along with controls to perform validation . You can associate the control with validator to set the Property of Validator named ControlToValidate. Every validator has ControlToValidate property. You can applies more than one validator to a single control. You must also set the Text Property of the validator so that when the validator perform validation it display the text whatsoever you write in the validator's text property.

1) Required Field Validator :- It checks whether the field is empty or not.

2) Compare Validator :- We can compare controls with the help of compare validators (For eg. normally we compare the TextBox like PasswordTextBox and ConfirmTextBox) and also check the DataType of the control (means what kind of datatype value control can take).

3) Range Validator :- With the help of it we can make a check for min. and max. values.

4) Regular Expression Validator :- It has pre-defined format. It is basically used to check the format of the email-id or internet url.

5) Custom Validator :- When we want to make our own validators than we use custom validator. We have to write the javascript for the custom validator.

6) Validation Summary :- With the help of it we can display all validators summary at the end of the all controls.

0 Comments:

Post a Comment



ONLINE JOBS