custombox模态中的ASP.NET按钮未触发单击事件

本文关键字:单击 事件 按钮 NET 模态 ASP custombox | 更新日期: 2023-09-27 18:19:48

嗨,我在我的asp.net网站上使用custombox modal,modal工作得很好,但modal页脚内的按钮BTNConfirm_Click即使是也不会触发点击

我对打开模态没有问题我对模态页脚内的按钮(BTNConfirm_Click)没有问题,即使(OnClick)也没有点击

我的调用模式函数:

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

我的LinkButton调用函数Modal:

<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>

custombox模态中的ASP.NET按钮未触发单击事件

您的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>