Chapter 3. Using the Validation Controls


In this Chapter

  • Overview of the Validation Controls

  • Using the RequiredFieldValidator Control

  • Using the RangeValidator Control

  • Using the CompareValidator Control

  • Using the RegularExpressionValidator Control

  • Using the CustomValidator Control

  • Using the ValidationSummary Control

  • Creating Custom Validation Controls

  • Summary

In this chapter, you learn how to validate form fields when a form is submitted to the web server. You can use the validation controls to prevent users from submitting the wrong type of data into a database table. For example, you can use validation controls to prevent a user from submitting the value "Apple" for a birth date field.

In the first part of this chapter, you are provided with an overview of the standard validation controls included in the ASP.NET 2.0 Framework. You learn how to control how validation errors are displayed, how to highlight validation error messages, and how to use validation groups. You are provided with sample code for using each of the standard validation controls.

Next, we extend the basic validation controls with our own custom validation controls. For example, you learn how to create an AjaxValidator control that enables you to call a server-side validation function from the client.




ASP. NET 2.0 Unleashed
ASP.NET 2.0 Unleashed
ISBN: 0672328232
EAN: 2147483647
Year: 2006
Pages: 276

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