Chapter 12. Validating User Input with Validation Controls


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


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

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