Chapter 8. Validation Controls


ASP.NET Developer's JumpStart
By Paul D. Sheriff, Ken Getz
Table of Contents
Part I.  Introduction to Microsoft .NET and ASP.NET


  • Investigate the validation controls provided by ASP.NET

  • Create Web forms that validate data

Before ASP.NET, validating the data users entered onto a Web page either required complex script code that ran in the client browser or a roundtrip to the server to run code on the server side to determine the validity of the data. Things are a lot simpler in ASP.NET. Here, you'll find a series of controls the validation controls that make validating data on either the client or server side much simpler.

If your users view your page using an "up-level" browser (that is, IE 4.0 or higher), ASP.NET can render script so that the browser can perform client-side validation. If not, ASP.NET can only validate the controls' data on the server. Even if your users browse to the page using an up-level browser, ASP.NET will always perform a final server-side validation, ensuring that no clever hacker can bypass the validation by replacing code on the client side. Performing client-side validation not only simplifies your development, but also makes the runtime experience more interactive your users see validation warnings immediately upon leaving a control that handles invalid data.

To add validation support to any control, add an associated validation control to the page and set the properties of the control to indicate the following:

  • The control that needs to be validated.

  • The set of acceptable values. This information differs depending on the type of validation control you're using.

  • The text to be displayed within the validation control if the associated control's value isn't valid.

  • The text to be displayed in a validation summary.

You can place the validation control at any location on the page, but most people place the control adjacent to the data-entry control it's validating.

In this chapter, you'll learn about the different types of validation controls, and you'll see examples of working with each.


    ASP. NET Developer's JumpStart
    ASP.NET Developers JumpStart
    ISBN: 0672323575
    EAN: 2147483647
    Year: 2002
    Pages: 234 © 2008-2017.
    If you may any questions please contact us: