7.5. Validation controls

Validation controls are used along with an input control to test what the user enters for that input control. Validation controls can check for a required field, test against a specific value pattern of characters, and so on.

Only a subset of HTML and web server controls can work with validation controls. Before using the control, check if it has a ValidationPropertyAttribute. The following controls can be used with validation controls:

  • HTMLInputText;

  • HTMLTextArea;

  • HTMLSelect;

  • HTMLInputFile;

  • TextBox;

  • DropDownList;

  • ListBox;

  • RadioButtonList.

All validation controls have a set of common properties defined by the ancestor class BaseValidator. These properties are listed overleaf.

  • ControlToValidate Specifies the ID of the input ...

Get A Programmer's Guide to .NET 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.