Chapter 12. Validating User Input with Validation Controls

<feature><title></title>

In this hour, we will cover

  • The various classes of input validation

  • How to use the RequiredFieldValidator to ensure that the user has provided input

  • How to use the CompareValidator

  • How to ensure that the user’s input falls between a range of values by using the RangeValidator

  • How to use the RegularExpressionValidator

</feature>

As we have examined in previous hours, collecting user input through an ASP.NET page is a relatively easy task. Unfortunately, when we’re collecting a user’s input, there is no guarantee that it has been provided in an acceptable format. Consider a page that prompts the user for his weight, much like we did with the BMI calculator a few hours ...

Get Sams Teach Yourself ASP.NET 3.5 in 24 Hours, Complete Starter Kit 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.