0% found this document useful (0 votes)
159 views

Validation Controls

The document discusses different types of validation controls in ASP.NET including required field, compare, range, regular expression, and custom validators. It also covers the display property which determines how validation error messages are rendered, and using Page.IsValid to check if all validators on a page pass. Examples are given for required field and compare validators showing their properties.

Uploaded by

api-19796528
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views

Validation Controls

The document discusses different types of validation controls in ASP.NET including required field, compare, range, regular expression, and custom validators. It also covers the display property which determines how validation error messages are rendered, and using Page.IsValid to check if all validators on a page pass. Examples are given for required field and compare validators showing their properties.

Uploaded by

api-19796528
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Validation Controls

By

SRIRAM. B
Validation Controls

 Required Field Validator


 Compare Validator
 Range Validator
 Regular Expression Validator
 Custom Validator
 Validation Summary
Setting Display Property
 Display property determines how the validation error message is rendered.
This property accepts any of the following possible values:-
 Static
- Screen space is reserved for the error message even if no validation occurs.
 Dynamic

- No initial space is reserved for the error message. If an error occurs, the
succeeding from fields are pushed to make the space for the error messages.
 None
- No error message is displayed.
Page.IsValid
 To determine if all input validation controls on a page are
valid.
if(Page.IsValid)
{
lblMessage.Text=”Page.Is Valid!”;
}
Required Field Validator
 Ensures that the user does not skip from entry field.
Property
ControlToValidate -
Specifies the ID of the control to be validated.

Display -
Sets how the error message contained in the Text Property is displayed.
Possible Values are Static, Dynamic, None
Compare Validator
 Allows for comparisons between the user's input and another
item using a comparison operator(equals, greater than, less
than,and so on)
Range Validator
 Checks the user's input based upon a lower-and-upper level
range of numbers ors characters
Regular Expression Validator

 Checks that the user entry matches a pattern defined by a


regular expression. This is a good control to use to check e-
mail addresses and phone numbers.
Custom Validator

 Checks the user entry using custom coded validation logic.


Validation Summary
 Displays all the error messages from the validators in one
specific spot on the page.
Demo
Session Ends
Exercise
Relax

You might also like