Validating User Input in an ASP.NET Web Page

In ASP.NET, input validation is performed through the use of—you guessed it—Web controls. The Web controls that perform input validation are commonly called validation Web controls or just validation controls.

There are four kinds of validation controls we'll be examining in this hour. Each of these Web controls, as summarized in Table 12.1, is geared for providing one or more of the input validation classes we've just been discussing.

Table 12.1. The ASP.NET Validation Web Controls
Validation ControlDescription
RequiredFieldValidatorEnsures that data has been entered into a specific input
CompareValidatorEnsures that a numeric value in one input is less than, less than or equal, equal, greater than, ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.