Chapter 12. Web Form Data Validation

   

In this chapter

Introduction to Data Validation in ASP.NET

ASP.NET Validation Controls

Regular Expressions Primer

This chapter talks about data validation in ASP.NET. ASP.NET provides a group of validation controls that will make your job as a Web form developer much easier. These controls easily handle the task of data validation in form elements and provide a consistent programming model for developers.

When do you need data validation in an HTML form? Any time you need to ensure the user data is either present or in a specific format. For example, if you are asking users to enter an e-mail address and they type XYZ, that is not a valid e-mail address. They might have purposely entered an invalid e-mail address, or they might have inadvertently entered it. If the e-mail address is not valid, your database will contain an invalid e-mail address. If, for example, you have to notify users via e-mail of upcoming events, this will cause a problem.

It gets even worse when users enter invalid data, the data is put in your database, and some type of ODBC error or ADO error is generated. Then you have to handle the database error, which adds a lot of extra code. Of course, many applications (as you can see by surfing the Internet) don't even handle the database errors correctly.

   


Special Edition Using ASP. NET
Special Edition Using ASP.Net
ISBN: 0789725606
EAN: 2147483647
Year: 2002
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net