Here i have explained how to validate a text filed using RequiredFieldValidator in Asp.Net.

The RequiredFieldValidator control is used to validate empty text fields. it ensures user that required text fields can not be blank.

HTML Markup

<asp:TextBox ID="TextBox1" placeholder="Name" runat="server"></asp:TextBox>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" Display="Dynamic" runat="server" ErrorMessage="Enter Your Name"></asp:RequiredFieldValidator>

Screenshot

Add Comments