Skip to Main Content
ASP.NET 4 24-Hour Trainer
book

ASP.NET 4 24-Hour Trainer

by Toi B. Wright
July 2010
Beginner content levelBeginner
552 pages
10h 14m
English
Wrox
Content preview from ASP.NET 4 24-Hour Trainer

Chapter 16A. Validation Controls in Web Forms

Your web application must verify that all of the data entered by users is valid. This once formidable task has been made easier by the validation controls that are included with the ASP.NET Web Forms framework. In this lesson I show you how to use the various validation controls.

The validation controls are located on the Validation tab of the Toolbox. These are the validation controls:

  • CompareValidator — This control is used to perform a data type check and to compare the values of two different controls.

  • CustomValidator — This control is used to perform custom validation. I cover the CustomValidator in Lesson 17A.

  • RangeValidator — This control is used to check that a given value is between two values.

  • RegularExpressionValidator — This control is used to compare a value against a regular expression. It is used to validate the formats of such things as email addresses and phone numbers.

  • RequiredFieldValidator — This control is used to ensure that a value has been entered.

  • ValidationSummary — This control displays a list of all of the validation errors on the page.

All of the validation controls (except ValidationSummary) use the following properties:

  • ControlToValidate — This is the ID of the control being validated. It is required.

  • Display — This property designates how the control is displayed. It has three possible settings: None, Static, and Dynamic. Static is the default. I show you an example that uses a combination of these settings later ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 4 24-Hour Trainer

ASP.NET 4 24-Hour Trainer

Toi B. Wright
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9780470596913Purchase bookExamplesErrata