That s Not ASP


Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 7.  Validating ASP.NET Pages

That's Not ASP!

With classic ASP, user input validation involved many separate checks, resulting in long, complex code. Listing 7.1 shows an example. The process often required many separate if statements to evaluate several conditions for each control. You had to make sure that users had entered items such as dates, names, and phone numbers in a valid format, and you had to find ways to make those values valid if they were not. This was tedious and error-prone.

With ASP.NET Validation controls, all your classic ASP validation worries fade away. You can validate user input automatically and provide feedback to the user dynamically. No more complex, nested if statements to debug!

Note that all of the functionality you learned about today was possible with classic ASP. However, it was up to the developer to build all of the client-side script and make sure that error messages were displayed properly. If you took a look at the WebUIValidation.js file from Listing 7.4, you'll see that this was not an easy task. There's quite a bit of functionality and code in this file. ASP.NET handles all of this for you, and even adjusts the script depending on the capabilities of the client browser.

Validation controls are one of the greatest improvements of ASP.NET over ASP, and you should take advantage of them thoroughly!


    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

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: