Home / ASP.NET Wiki / HTML / Web Controls / Validation Controls

Validation Controls

 Rate It (2)

ASP.NET Validation Controls are powerful server controls that are used for validating user input.  These controls provides both server side and client side validation.

The client side validation features can be used to give your users an improved UI experience.  By using the client side features, your users will not need to wait for a full page postback to occur only to discover that they have failed to fill out your form completely.  Instead, the client side features can be using to notify the user immediately (before the page is submitted) about any missing and/or invalid data.

One of the shortcomings of the validation controls under the 1.1 Framework was the inability to validate only portions of your form.  Whenever the validators were triggered, all validators on the page were checked even if they might not be related to the particular button being clicked.  With the 2.0 Framework, a new ValidationGroup property was introduced.  By setting the ValidationGroup property on a button, only those validation controls that were also set to that same ValidationGroup will be checked. 

The validation can be checked on the server side with the help of the IsValid property of the validation control.  Additionally, you can use the IsValid property of the Page to check the validation result of all validation controls on the page.  Before testing the IsValid property of the validation control or the page, it is important that the validation check has already been performed through the use of the Validate method.  You can call Validate on individual controls and also on the page itself.

Here is a list of the validation controls

Links
White papers/Blogs:
Videos

 

Revision number 5, Thursday, July 17, 2008 1:11:20 PM by vik20000in

Comments

Artilce is good. But most of the Links not working. so we are unable to know more about the Validation controls.

good article, my required information was there.

I think we are still lacking a multi control validator which can check all the controls on a page and displays a message when any of the controls are empty. For example: I have a search form with various controls (TextBoxes, ListBoxes and DropDownLists). I like to STOP the empty search in other words 'NULL search is not allowed'. When the user tries to hit search button without entering atleast a sinle search criteria/not selecting a dropdown list or ListBox, I want to stop the search. There is no in built control to achieve the above requirement until today (ASP.NET 3.5/4.0). We have to rely on third party controls. Please do let me know if this can be achieved easily by using existing validation controls. Thanks,

Related Articles

Input and Data Validation

Garbage in, garbage out. You can avoid data cleanup tasks on the backend by avoiding bad data coming in. ASP.NET validation controls and third party validation controls help you receive the right data in the right format. In addition, the AJAX Control Toolkit

ValidationSummary

A ValidationSummary control is displayed when the IsValid property of the page is false. It "polls" each of the validation controls on the page and aggregates the text messages exposed by each. It does thisthrough the Page.Validators collection;

Data-centric UI Controls

Both the GridView and ListView areimportant Data Controls in Visual Studio 2008. Scott Guthrie has a great introduction that uses the ListView Control. He builds a product catalog from scratch with complete control over the CSS and HTML. Editing, Inserting

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)