What is RequiredField validator in asp.net?
You can use it to make sure that the user has entered something in a TextBox control. Let's give it a try, and add a RequiredFieldValidator to our page. We will also add a TextBox to validate, as well as a button to submit the form with.
<form id="form1" runat="server">
Your name:<br />
<asp:TextBox runat="server" id="txtName" /> <asp:RequiredFieldValidator runat="server" id="reqName" controltovalidate="txtName"
errormessage="Required" />
<br /><br />
<asp:Button runat="server" id="btnSubmitForm" text="Button" />
</form>
You can use it to make sure that the user has entered something in a TextBox control. Let's give it a try, and add a RequiredFieldValidator to our page. We will also add a TextBox to validate, as well as a button to submit the form with.
<form id="form1" runat="server">
Your name:<br />
<asp:TextBox runat="server" id="txtName" /> <asp:RequiredFieldValidator runat="server" id="reqName" controltovalidate="txtName"
errormessage="Required" />
<br /><br />
<asp:Button runat="server" id="btnSubmitForm" text="Button" />
</form>
No comments:
Post a Comment