Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在代码隐藏中显示模式弹出窗口_C#_Asp.net - Fatal编程技术网

C# 在代码隐藏中显示模式弹出窗口

C# 在代码隐藏中显示模式弹出窗口,c#,asp.net,C#,Asp.net,我正在显示ajaxcontrol工具包ModalPopupXtender,以便在单击按钮时从代码隐藏中显示。 在我的按钮点击我上传文件和发送电子邮件,并在发送电子邮件后,我显示模式弹出几秒钟,然后我重定向到索引页面的用户 我遇到的问题是,只有当我没有重定向时,modalpoup才会显示 这是我的aspx代码 <input type="btmodel" runat="server" style="display: none"> <ajaxToolkit:ModalPop

我正在显示ajaxcontrol工具包ModalPopupXtender,以便在单击按钮时从代码隐藏中显示。 在我的按钮点击我上传文件和发送电子邮件,并在发送电子邮件后,我显示模式弹出几秒钟,然后我重定向到索引页面的用户

我遇到的问题是,只有当我没有重定向时,modalpoup才会显示 这是我的aspx代码

<input type="btmodel" runat="server" style="display: none">
     <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btmodel"
            PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader" Drag="true" DropShadow="true"
            OkControlID="OkButton" CancelControlID="CancelButton" BackgroundCssClass="ModalPopupBG">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Panel ID="Panel1" Style="display: none" runat="server">
            <div class="HellowWorldPopup">
                <div class="PopupHeader" id="PopupHeader">
                    Progress</div>
                <div class="PopupBody">
                    <p>
                       Processing.....</p>
                </div>
                <div class="Controls">
                    <input id="btnOkay" type="button" value="Ok" onclick="OkScript()" />
                </div>
            </div>
        </asp:Panel>
我在ModalPopupExtender1.Show()之前也尝试过这个,但没有成功

System.Threading.Thread.Sleep(1000);

关键是在用户关闭弹出窗口时进行重定向,而不是在您显示弹出窗口时。
编写代码来处理“OnOkScript”或“OnCancelScript”,并改为在那里重定向。

请注意,在ASP.NET(或任何Web服务器/客户端浏览器环境)中,服务器端代码将一直执行到最后,然后将结果发送到客户端浏览器。这不是一种设计上的来回交流

System.Threading.Thread.Sleep(1000);