3. VALIDATION
Validation is important part of any web application.
User’s input must always be validated before sending
across different layers of the application.
4. TYPES OF VALIDATION CONTROLS :
There are six types of Validation Control in ASP.NET
:
1. RequiredFieldValidation Control
2. Compare Validator
3. Range Validator
4. RegularExpression Validator
5. Custom Validator
6. Validation Summary
5. 1) RequiredFieldValidation Control
• We can use the RequiredFieldValidation Control
to ensure that a particular input field in a form is
not left blank.
• And if it is left blank, the error message will be
displayed.
6. EXAMPLE :
Enter Your Name
:
Button
Enter Your Name
:
Button
! Please Enter Name
> Clicked
abcd Enter Your Name
:
OK
abcd
7. 2) CompareValidator Control
• CompareValidator Control is used to
compare the value of one input control to
the value of another input control.
• For Example: Password
9. 3) RangeValidator Control
• RangeValidator Control evaluates the
value of an input control to check that the
valued lies between specified range.
Control
• This can be a number , an alphabet or a
Date.
10. 4) RegularExpressionValidator
Control
• The RegularExpressionValidator Control helps ensure
that user input matches a defined pattern using regular
expression.
• For Example: Email ID, Phone Number.
11. 5) CustomValidator Control
• You can create a CustomValidator Control to
perform custom validation on user input.
• For Example:
1. Password must be between 6-12 characters.
2. Must have numeric value.
3. It must contain underscore.
User must
have to follow
these steps.