验证控制防止按钮重定向到另一个页面 [英] Validation control preventing button from redirecting to another page

查看:59
本文介绍了验证控制防止按钮重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在做一个登录页面,我已经使用了用户名文本框和密码文本框的验证控件。随之而来的是,我已经创建了指向另一个页面的图像按钮。但是当我点击该图像按钮时,这个验证控件阻止我去那个页面。任何人都可以告诉我如何避免这个。下面是我的HTML代码:

Hi i am doing a login page and i have used validation controls for username textbox and password textbox.Along with this, i have created image button which direct to another page.but when i click on that image button, this validation control prevents me from going to that page.Can anyone tell me how to avoid that.Below is my html code:

 <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     UserName/Email:<br />
<asp:TextBox ID="TextBox1" runat="server" MaxLength="60" class="water"   ></asp:TextBox><asp:RequiredFieldValidator
    ID="RequiredFieldValidator1" runat="server" ErrorMessage="*Username/Email Required" 
            ControlToValidate="TextBox1" ForeColor="Red"></asp:RequiredFieldValidator><br />
Password:<br />
<asp:TextBox ID="TextBox2" runat="server" MaxLength="60" class="water"  TextMode="Password" ></asp:TextBox><asp:RequiredFieldValidator
    ID="RequiredFieldValidator2" runat="server" ErrorMessage="*Password Required" 
            ControlToValidate="TextBox2" ForeColor="Red"></asp:RequiredFieldValidator><br />
            <asp:Button ID="Button7" runat="server" Text="Login" BackColor="#BD362F" 
          ForeColor="White" onclick="Button7_Click"></asp:Button><br />
                  <asp:ImageButton ID="ImageButton1" runat="server" 
            ImageUrl="~/images/new_user_signup.jpg" Width="150px" 
    onclick="ImageButton1_Click" />
    
    </ContentTemplate>
    </asp:UpdatePanel>

推荐答案

同时尝试并应用验证组属性。
Also try and apply validation group property.


这篇关于验证控制防止按钮重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆