Introduction to the RequiredFieldValidator Control

Use the RequiredFieldValidator control to validate that the user entered a data value into a SelectionList or TextBox control. With a SelectionList control, the user must select an item in the list. With a TextBox control, the user must enter a value.

ASP.NET Required Field Validator

Set the RequiredFieldValidator control's ControlToValidate property to the ID of the SelectionList or TextBox control to validate. If the data value is not present, the RequiredFieldValidator control displays the value of its ErrorMessage property.

When you add a RequiredFieldValidator control to a container control or template:

For detailed information about properties of this control, see the Properties section of the RequiredFieldValidator topic.