执行XML创建时,AJAX ModalPopup Hide()不会关闭 [英] AJAX ModalPopup Hide() does not close when executing XML Creation
问题描述
我在一个带按钮显示的aspx页面中有一个AJAX ModalPopUp,此弹出窗口仅用于确认Excel/XML文件的创建.问题在于,当您使用Click方法确认创建时,不会执行Hide()方法.
I have an AJAX ModalPopUp in an aspx page which is displayed with button, this Popup is just to confirm the creation of the Excel/XML file. The problem is that when you confirm the creation, with the Click method, the Hide() method is not executed.
private void bOk_Click(object sender, System.EventArgs e)
{
ModalExcelPopUp.Hide();
CreateExcelXMLFile();
}
我使用的是母版页,其中定义了ScriptManager.我正在使用ASP.NET 2005
I am using a Master Page, in which I have the ScriptManager defined. I am using ASP.NET 2005
推荐答案
在处理之前,应给浏览器一些时间来执行hide命令.只有一个线程,而您的click事件正在使用它,因此只有完成操作之后,才可以进行屏幕更新.但是有一个简单的解决方案:-D
You should give the browser some time to execute the hide command before processing. There is only a single thread and your click event is using it, so no screen update until you''re done. But there is a simple solution :-D
private void bOk_Click(object sender, System.EventArgs e)
{
ModalExcelPopUp.Hide();
setTimeout("CreateExcelXMLFile();", 50);
}
在上面的代码中,计时器用于在开始创建XML文件之前给ui线程一些时间来更新屏幕.
祝你好运!
In the above code the timer is used to give the ui thread some time to update the screen before starting to create the XML file.
Good luck!
这篇关于执行XML创建时,AJAX ModalPopup Hide()不会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!