Click here to Skip to main content
Click here to Skip to main content

Validation Controls

, 11 Oct 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
ASP.NET Validation Controls are powerful server controls that are used for validating user input.  These controls provides both server side and

Editorial Note

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

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

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ASP.NET Community

United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.
 
The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

428 members


Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 11 Oct 2013
Article Copyright 2013 by ASP.NET Community
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid