7.12. Validation Controls
Whenever we solicit user input, the possibility exists that the user will make an error. If possible, we'd like to catch as many errors as possible before we process the form. For example, if we are accepting credit card information, we can verify that the user has entered a credit card number and expiration date. The credit card number should be all digits, of course, and for Visa and Mastercard it should be 16 digits in length. Beyond that, we can't determine if it represents a valid credit card number. Similarly, the expiration date's month should be between 1 and 12, the year should be equal to or greater than the current year, and so on.
Web Forms provides validation controls to simplify the checking of user input. ...
Get C# Primer: A Practical Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.