Export (0) Print
Expand All

RequiredFieldValidator control

The RequiredFieldValidator control ensures that the user does not skip a required entry field.

A RequiredFieldValidator works in conjunction with another control, for example a TextBox control. Add the control you want to validate to your page before you add the RequiredFieldValidator so that you can easily associate the RequiredFieldValidator with it.

To add a RequiredFieldValidator control to a page

  1. Drag the RequiredFieldValidator control from the Toolbox task pane to your page.

  2. Select the RequiredFieldValidator in Design view, right-click it, and click Properties on the shortcut menu.

  3. In the Tag Properties task pane, select the control you want to validate with the RequiredFieldValidator in the ControlToValidate property dropdown.

  4. Set the ErrorMessage property to the text you want to be displayed when a user leaves the control blank.

  5. If you are going to use a ValidationSummary control to consolidate validation error messages, set the ValidationGroup property to the name of the group of validation controls. This can be any string, as long as all the controls in the group have the same value.

  6. For a full description of all RequiredFieldValidator control properties, see RequiredFieldValidator Members in the MSDN library.

  7. For more information about using validation controls to validate user input, see How-to Topics — Validation Controls in the MSDN library.

Community Additions

ADD
Show:
© 2014 Microsoft