Performing Automatic Validation

ASP.NET Web Forms contains a set of controls that you can use to perform automatic data validation. You use these controls to specify one or more rules that define valid data, and if these rules are broken, the user is shown an error message explaining what went wrong. These controls also let you consolidate your validation rules in a single place, which makes maintaining them a lot simpler. You can see the controls in the Validation section of the Toolbox window, as shown in Figure 17-2.

images

Figure 17-2. The Web Forms validation controls

When you use a validation control, you position it where you want the error ...

Get Applied ASP.NET 4 in Context 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.