我正在展示 ajaxcontrol 工具包 ModalPopupExtender,以便在单击按钮时从后面的代码中显示。在我的按钮上单击我正在上传文件并发送电子邮件,在发送电子邮件后我将显示模态弹出窗口几秒钟,然后我将用户重定向到索引页面。
我遇到的问题是 ModalPopup 仅在我不重定向时才显示这是我的 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>
和我的按钮点击代码
protected void btnupload_Click(object sender, EventArgs e)
{
//File uploading
//Sending Email
ModalPopupExtender1.Show();
Response.Redirect("Default.aspx");//If I comment this line,then modal is showing
}
我也在 ModalPopupExtender1.Show() 之前尝试过这个,但没有运气
System.Threading.Thread.Sleep(1000);