1. Home
  2. Computing & Technology
  3. Visual Basic

ASP.NET - Learn Programming for the Networked World - Part 2

By Dan Mabbutt, About.com

5 of 7

The Validator Controls

Validator Control Code

Validator Control Code

The last type of server control is called a validator. Rather than having to write custom script or VB code to check whether data returned by other controls is within specifications, ASP.NET includes a new type of control that checks it for you. The five types of validator controls you can use are:

  • RequiredFieldValidator
  • CompareValidator
  • RangeValidator
  • RegularExpressionValidator

... and a sort of "roll your own" control:

  • CustomValidator

There's also a new ValidationSummary control that you can use to display the error messages from all the validation controls in one place.

An example of the CompareValidator in action can be seen at the bottom.

These simple examples demonstrate that one of the best features of ASP.NET is that it handles most of the work of capturing, transmitting, and interpreting the event.

5 of 7

Explore Visual Basic

More from About.com

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Learn ASP.NET
  6. ASP.NET - Learn Programming for the Networked World - Part 2

©2008 About.com, a part of The New York Times Company.

All rights reserved.