By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

How to have One RequiredFieldValidator to Validate Two TextBox

P: n/a
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>
<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>

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.