Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

9.4. Summary

User input is an important aspect of most interactive web sites. It comes from different sources in your web site: the contact form you created in this chapter, the query string, and other sources. To stop users from entering invalid or even dangerous content into your system, it's important to validate all input before you work with it.

The validation controls that ASP.NET supports make it easy to validate all data coming from form controls, such as TextBox, DropDownList, Calendar, and so on. The RequiredFieldValidator helps to ensure that a user has filled in a required field. The RangeValidator, CompareValidator, and RegularExpressionValidator are used to check the contents of the data against settings you define at design time. The CustomValidator allows you to write validation code that is not covered by the built-in validation controls, giving you maximum flexibility. The ValidationSummary control is used to give feedback about the errors that your users made while entering data. It can display these errors as a simple bulleted list in the page, or as a JavaScript alert window.

The biggest benefit of the validation controls is that they work at the client and at the server, enabling you to create responsive forms where a user gets immediate feedback about any errors they may have made, without the need for a full postback. At the same time, the data is validated at the server, ensuring that data coming from clients that don't support JavaScript is valid as well. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book