自定义框模式中的ASP.NET按钮不会触发单击事件

时间:2015-10-29 10:34:22

标签: c# asp.net

您好我在我的asp.net网站上使用custombox模式,模态工作正常但按钮BTNConfirm_Click内部模态页脚甚至不触发点击

我打开模态我没有问题我有按钮(BTNConfirm_Click)内部模态页脚没有触发点击甚至(OnClick)

我的呼叫模式功能:

    <script>
    $(function Modal() {
        $('#LkForget').on('click', function (e) {
            Custombox.open({
                target: 'Page/ForgotPassword.aspx',
                effect: 'fadein'
            });
            e.preventDefault();
        });
    });
</script>

我的LinkBut​​ton调用函数模态:

<asp:LinkButton Style="font-size: 13px; color: #FFF; font-family: yekan,tahoma; margin-right: 92px;"
                                ID="LkForget" runat="server" OnClientClick="Modal()">Forgot Password</asp:LinkButton>

我的代码:

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
    <div class="Modal">
        <button type="button" class="close" onclick="Custombox.close();">
            <span>×</span><span class="sr-only">Close</span>
        </button>
        <h4>
            Forgot password</h4>
        <table class="fullWidth" style="margin: 15px; line-height: 35px; text-align: left;">
            <tr>
                <td>
                    Username:&nbsp;&nbsp;
                </td>
                <td>
                    <asp:TextBox onCopy="return false" onDrag="return false" onDrop="return false" onPaste="return false"
                        Style="height: 25px;" CssClass="txtborder" ID="TXTUserName" runat="server" placeholder="Enter Your Username"></asp:TextBox>
                    <asp:RequiredFieldValidator ValidationGroup="2" ID="RequiredFieldValidator3" runat="server"
                        ControlToValidate="TXTUserName" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Email addres:&nbsp;&nbsp;
                </td>
                <td>
                    <asp:TextBox onCopy="return false" onDrag="return false" onDrop="return false" onPaste="return false"
                        Style="height: 25px;" CssClass="txtborder" ID="TXTEmail" runat="server" placeholder="Enter Your Email"></asp:TextBox>
                    <asp:RequiredFieldValidator ValidationGroup="2" ID="RequiredFieldValidator4" runat="server"
                        ControlToValidate="TXTEmail" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Type the code:
                </td>
                <td>
                    <div style="margin-right: 50px;" class="captcha-wrapper center">
                        <div id="Div1" class="img-code left">
                            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                                <ContentTemplate>
                                    <input type="button" class="refresh left block" src="Img/refresh.png" onclick="loadXMLDoc()">
                                    <asp:Image ID="SecImgForget" runat="server" src="img/SecCaptcha.jpg" alt="" class="left" />
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                        <asp:TextBox runat="server" ID="TCapchaForget" class="code block" placeholder="Enter Security Code"></asp:TextBox>
                    </div>
                </td>
                <td>
                    <asp:RequiredFieldValidator ValidationGroup="2" ID="RequiredFieldValidator5" runat="server"
                        ControlToValidate="TCapchaForget" ErrorMessage="" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
        </table>
        <h5>
            <asp:Button class="purple-btn choose-bank table center btnform" ID="BTNConfirm" runat="server"
                Text="Receive Password" OnClick="BTNConfirm_Click" ValidationGroup="2" />
        </h5>
    </div>
</div>
</form>

1 个答案:

答案 0 :(得分:0)

你的jquery应该是

 <script type="text/javascript">
    $(function () {
        $('#LkForget').on('click', function (e) {
            Custombox.open({
                target: 'Page/ForgotPassword.aspx',
                effect: 'fadein'
            });
            e.preventDefault();
        });
    });
</script>



<asp:LinkButton Style="font-size: 13px; color: #FFF; font-family: yekan,tahoma; margin-right: 92px;"ID="LkForget" runat="server" >Forgot Password</asp:LinkButton>