How to have One RequiredFieldValidator to Validate Two TextBox

N

Nicolas

How can I have only one RequiredFieldValidator to control two TextBox webcontrols so that only one message is displayed

<asp:Label id="lbl_UserName" runat="server"></asp:Label><br>
<asp:TextBox id="txt_UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator id="R_lbl_UserName" runat="server" ControlToValidate="txt_UserName" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<br>
<asp:Label id="lbl_Password" runat="server"></asp:Label><br>
<asp:TextBox id="txt_Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator id="R_lbl_Password" runat="server" ControlToValidate="txt_Password" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,216
Latest member
Best cryptoconsultant

Latest Threads

Top