开发者

validation showing in both panels in asp.net

i am using two panels (login and registration) in asp.net where in both panels i used button control. and i also used validations for particular textboxes in both panels. i want to show both panels at same time. now what problem i am facing is that when i click on button of login panel, it shows validation error text in registration panel and vice-versa..

Is there nay other way to use any other control instead of button. i am using visual studio-2008

i had created login panel as:

  <asp:Panel ID="pnllogin" runat="server">
                <table class = "style1">
                <tr>
                <td>
                <asp:Label ID="lblloginid" runat="server" Text="Login_ID" Font-Bold="true"></asp:Label>
                </td>
                <td>
                <asp:TextBox ID="txtboxloginid" runat="server" ></asp:TextBox>
                <asp:RequiredFieldValidator ID="requiredfieldvalidator1" runat="server" 
                ControlToValidate="txtboxloginid" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>                
                </tr>

                <tr>
                <td>
                <asp:Label ID="lblpassword" runat="server" Text="Password" Font-Bold="true"></asp:Label>                
                </td>
                <td>
                <asp:TextBox ID="txtboxpassword" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="requiredfieldvalidator2" runat="server" 
                ControlToValidate="txtboxpassword" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
                </tr>
               <tr>
               <td></td>
               <td>
               <asp:HyperLink ID="hyperlinkforgotpassword" runat="server" ForeColor="Red" NavigateUrl="~/ForgotPassword.aspx">Forgot Password??</asp:HyperLink>
               </td>
               </tr>
               <tr>
               <td>&nbsp;</td>
               <td>
  开发者_JS百科             <asp:ImageButton ID="imgbtnlogin" runat="server" ImageUrl="~/images/login.png" 
                       onclick="imgbtnlogin_Click" />
               </td>
               </tr>                
                </table>              

                </asp:Panel>  

and somewhat same code for registration panel..

can someone please help me..


Make use of ValidationGroup property to fire the validation message related to proper panel

here is detail info : http://www.w3schools.com/ASPNET/prop_webcontrol_imagebutton_validationgroup.asp

demo : http://www.w3schools.com/ASPNET/showasp.asp?filename=demo_prop_webcontrol_imagebutton_validationgroup

Specifying Validation Groups

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜