ASP.NET RequiredFieldValidator Control
This validator is used to make an input control required. It will throw an error if user leaves input control empty.
It is used to mandate form control required and restrict the user to provide data.
Note: It removes extra spaces from the beginning and end of the input value before validation is performed.
The ControlToValidateproperty should be set with the ID of control to validate.
Here, in the following example, we are explaining RequiredFieldValidator control and creating to mandatory TextBox controls.
It produces the following output when view in the browser.
It throws error messages when user login with empty controls.