Try this example and see how I used the
RequiredFieldValidator
to make sure that user enters the
Name
field. I believe, you can implement your own :)
<div>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
<asp:TextBox ID="TxtName" runat="server"></asp:TextBox><asp:RequiredFieldValidator
ID="RequiredFieldValidator1" ControlToValidate="TxtName" runat="server" ErrorMessage="Name is required."></asp:RequiredFieldValidator>
<br />
<asp:Label ID="Label2" runat="server" Text="Address"></asp:Label>
<asp:TextBox ID="TxtAddress" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Submit" />
</div>