TRequiredFieldValidator makes the associated input component a required field. The input component fails validation if its value does not change from the InitialValue property upon losing focus.
Namespace: System.Web.UI.WebControls
Properties
InitialValue, string, kept in viewstate
Gets or sets the initial value of the associated input component.
The associated input component fails validation if its value does not
change from the InitialValue upon losing focus.
Examples
On a page template file, insert the following lines to test the validator,
<com:TRequiredFieldValidator ControlToValidate="username" ErrorMessage="User name is required."/>
When the user submits the page, username input field will be automatically validated by the validator. If no value is entered, the error message will be displayed.
Set the anchor ID for the error message link. If the value is "true" then the ID of the ControlToValidate will be used otherwise the given value will be used as the anchor.