Improved Input Validation (Page 1 of 9 )
The
first part of this series explained the importance of input validation, especially in the context of a Web-based application, and a quick overview of the types of validation controls built into ASP.NET. This was followed by a whirlwind introduction to some useful validation controls such the RequiredFieldValidator control, RangeValidator control and CompareValidator control. Today, Find out how to perform more sophisticated input validation with the remaining two Validator controls, the RegularExpressionValidator control and the CustomValidator control.
Moving on from where I left off, this concluding segment explains how you can perform more sophisticated input validation with the remaining two Validator controls, the RegularExpressionValidator control and the CustomValidator control. These two controls are not as simple as the ones you've just seen, so you'll need to have all your wits about you when we start in on them. Additionally, I'll demonstrate how you can display a summary of input validation errors to the user instead of displaying errors as they occur, on a per-control basis.
Buckle up your seat belts and get ready for a wild ride!
So What's a $#!%% Regular Expression, Anyway?!
Regular expressions, also known as "regex", are powerful tools used in pattern-matching and substitution. They are commonly associated with almost all *NIX-based tools, including editors like vi, scripting languages like Perl and PHP, and shell programs like awk and sed.
A regular expression lets you build patterns using a set of special characters. These patterns can then be compared with text in a file, data from an application, or input from a form. Depending on whether or not there's a match, appropriate action can be taken, and appropriate program code executed.
Next: Common Applications >>
More ASP.NET Articles
More By Harish Kamath (c) Melonfire