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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.