【发布时间】:2013-04-25 10:08:27
【问题描述】:
我的页面上有 UpdataPanel 和 UpdateProgress。在此页面中,我重定向到负责下载生成文件的下载页面。 通过控件单击事件之一在 UpdatePanel 中重定向到下载页面。 问题是下载文件 UpdateProgress 后并没有消失。 (我将下载页面的 ContentType 设置为正确的 mime 类型)
【问题讨论】:
标签: asp.net asp.net-ajax updatepanel
我的页面上有 UpdataPanel 和 UpdateProgress。在此页面中,我重定向到负责下载生成文件的下载页面。 通过控件单击事件之一在 UpdatePanel 中重定向到下载页面。 问题是下载文件 UpdateProgress 后并没有消失。 (我将下载页面的 ContentType 设置为正确的 mime 类型)
【问题讨论】:
标签: asp.net asp.net-ajax updatepanel
我在更新面板的一个事件中找到了另一种下载文件的方法。
我用 i 框架来做到这一点。 onClick 事件我将内联 iframe 添加到带有我的文件地址的页面。
var script = @"
var iframe = document.createElement(""iframe"");
iframe.src = '{0}';
iframe.style.display = ""none"";
document.body.appendChild(iframe);";
ScriptManager.RegisterStartupScript(string.Format(script, url));
这解决了我的问题。
【讨论】: