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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.