Day 7. Validating ASP.NET Pages


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Week 1.  At a Glance

Validating user input in ASP.NET Web forms is one of the most important tasks for developers. Users are very unpredictable when it comes to supplying information, so you must take extra precautions to make sure they give you the correct data. For example, suppose you ask a user for a credit card number. What happens if he enters non-valid input, such as dgffg934053? Or what if he leaves off one digit of the number? Obviously, this will cause some problems in your application, especially when he tries to place an order.

In ASP.NET, these types of validation are easy to perform. You have a bevy of options for validating user input, including pattern matching and making sure the input is within a given range. The Validation controls provide a number of methods to alert users about errors, and they can do so dynamically without requiring a post to the server. And when one of the built-in options doesn't meet your needs, you can build your own!

Today you're going to look at various ways to validate user input easily with ASP.NET. Specifically, you'll look at the Validation server controls, which make data entry validation easier than ever. You'll also look at examples of creating your own validation routines.

Today's lesson will cover the following:

  • Why and how to validate user input before ASP.NET

  • What ASP.NET Validation controls are and how they work

  • How to implement Validation controls in your pages

  • How to customize error messages displayed to the user

  • How to build custom Validation controls


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne © 2008-2017.
    If you may any questions please contact us: