Validation Controls Validation Controls Validation means checking the

  • Slides: 6
Download presentation
Validation Controls

Validation Controls

Validation Controls • Validation means checking the input of the user and if his

Validation Controls • Validation means checking the input of the user and if his input is correct, the user is validated. • Validation controls are provided to allow us to – check for a required field, – to test against a specific value or pattern of characters, – to verify that a value lies within a range, and so on. • Validation controls provide us with a way to check user input in Web or HTML server controls.

How it works • Once a user submits his form, the Web Forms framework

How it works • Once a user submits his form, the Web Forms framework passes the information to the associated validation control. • The validation controls checks the information and set a property to indicate whether the information is correct or not. • After all validation controls have been processed, the Is. Valid property on the page is set automatically, if any of the controls shows that a validation check failed, the entire page is set to invalid.

Characteristics • All the features of the validation controls are same as that of

Characteristics • All the features of the validation controls are same as that of the other Web Server controls • In addition it generates the client side validation code for Internet explorer 5 and above. • This code uses DHTML to display the content of the validation control dynamically. • It also prevents the page to be submitted if the validation fails. • It also protects against Spoofed values. • Even if validation controls are doing client side validation, they always perform the same validations on the server also.

Validation Control Base Class • Validation Controls are provided in the following namespace: System.

Validation Control Base Class • Validation Controls are provided in the following namespace: System. Web. UI. Web. Control • All the Validation Controls inherit from the base class Base. Validator which is a part of the class library System. Web. UI. Web. Control. Base. Validator. • This gives us a number of properties which are common to all the Validation Controls.

Types of Validation Controls • • • Required. Field. Validator Control Regular. Expression. Validator

Types of Validation Controls • • • Required. Field. Validator Control Regular. Expression. Validator Control Range. Validator Control Compare. Validator Control Custom. Validator Control