将updatepanel用作ModelpopupExtender的PopupControl时,单击事件未触发

时间:2018-09-05 14:12:02

标签: asp.net webforms ajaxcontroltoolkit

这是我用来使用ajaxtoolkitmodelpopup extender

创建弹出窗口的代码

我尝试通过两种方式使用Updatepanel:

1)面板内的UpdatePanel

2)UpdatePanel内部的面板

弹出事件在没有UpdatePanel的情况下可以正常工作,但是会报告EventValidation错误以注册进行验证。

我还尝试了registeringEventValidationcontrolId的使用,但是此过程很耗时间。

<asp:Button ID="btnShowPopupOTP" runat="server" Style="display: none" />
<cc1:ModalPopupExtender ID="mdlPopupOTP" runat="server" TargetControlID="btnShowPopupOTP" PopupControlID="pnlPopupOTP" BackgroundCssClass="modalBackground"
/>

<asp:Panel Width="400px" BorderWidth="1px" runat="server" Style="background: #FFFFFF; BorderWidth:1px ;  height:auto; padding-bottom:10px; border-style:none; box-shadow: 0 0 15px 6px rgba(0,0,0,.1);">
    <asp:UpdatePanel ID="pnlPopupOTP" runat="server">
        <ContentTemplate>
            <div style=" background-color: #fff; display:block;margin:0px auto; ">
                <div style="background-color:#f3f7f8 ; display:block;">
                    <h2 style="color:rgb(8, 106, 135); padding:13px 0px 13px 0px; margin:0px 0px 0px 0px; text-align:center">Please
                        Do OTP Verification</h2>
                </div>
                <div style="margin-left:2%">
                    <div style="margin:0 auto;">
                        <asp:Label ID="lblOTPStatus" style="display:block; margin:10px auto; font-size:small; text-align:center;" runat="server"></asp:Label>
                    </div>
                    <div style="margin:0 auto;">
                        <asp:Label ID="lblOTPMessage" style="display:block; color:Gray; margin:10px auto; font-size:small; text-align:center;" runat="server"></asp:Label>
                    </div>
                    <div style="margin:0 auto;">
                        <asp:Label ID="lblOTPNoHint" style="display:block; color:Gray; margin:10px auto; font-size:small; text-align:center;" runat="server"></asp:Label>
                    </div>
                    <div id="txtOTPENTERDiv" runat="server" style=" background-color:#fff; display:block; margin:10px auto; overflow:none!important; height:auto; text-align:center">
                        <asp:Label ID="Label2" Text="Enter OTP" style="display: inline-block;font-size:small; margin:0 2% 0 0;" runat="server"></asp:Label>
                        <asp:TextBox ID="txtOTP12" Text="" runat="server" autocomplete="off" style="width:80px; overflow:none!important; height:auto; display:inline-block;"></asp:TextBox>
                        <asp:Button ID="btnPopupResendOTP" Text="Resend OTP" runat="server" OnClick="btnPopupSendOTP_Click" class="btn btn-success"
                            style="margin:0 4% 0 0;"></asp:Button>
                        <asp:HiddenField ID="hdnOTP12" Value="" runat="server"></asp:HiddenField>
                    </div>
                    <div style=" background-color: #fff; display:block; margin:10px auto;text-align:center;">
                        <asp:Button ID="btnPopupSendOTP" Text="Send OTP" runat="server" OnClick="btnPopupSendOTP_Click" class="btn btn-success" style="margin:0 4% 0 0;"></asp:Button>
                        <asp:Button ID="btnPopupVerifyOTP" Text="Verify" runat="server" OnClick="btnPopupVerifyOTP_Click" class="btn btn-primary"
                            style="margin:0 4% 0 0;"></asp:Button>
                        <asp:Button ID="btnPopupCancel" Text="Cancel" runat="server" OnClick="btnPopupCancelOTP_Click" class="btn btn-primary" style="margin:0 4% 0 0;"></asp:Button>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:asyncpostbacktrigger ControlID="btnPopupSendOTP" EventName="Click" runat="server" />
            <asp:asyncpostbacktrigger ControlID="btnPopupResendOTP" EventName="Click" runat="server" />
            <asp:asyncpostbacktrigger ControlID="btnPopupVerifyOTP" EventName="Click" runat="server" />
            <asp:asyncpostbacktrigger ControlID="btnPopupCancel" EventName="Click" runat="server" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Panel>

1 个答案:

答案 0 :(得分:0)

   Please remove runat="server"  in
   <Triggers>
            <asp:asyncpostbacktrigger ControlID="btnPopupSendOTP" 
    EventName="Click" />

  </Triggers>
  and then execute.