【发布时间】:2016-12-12 10:02:06
【问题描述】:
我遇到了模态关闭问题...
所以我有这个按钮btnReportingExport,它位于模态框内
<div id="Reporting_footer" class="modal-footer">
<asp:Button ID="btnReportingExport" runat="server" Text="Export"
CssClass="btn btn-default" OnClientClick="ChangeModalFunction();"
OnClick="btnReportingExport_Click"/>
<input id="Submit1" class="btn btn-default" type="submit" data-dismiss="modal"
value="Cancel" />
</div>
那个按钮首先调用JS函数ChangeModalFunction,看起来像这样
function ChangeModalFunction() {
$('#Reporting_modal').modal('hide');
$('#GenerateReport_modal').modal('toggle');
}
所以我只是隐藏模态并显示另一个模态,它上面只有一些 .gif 动画来生成报告。在那之后,我的主要活动发生在btnReportingExport_Click,它做了很多事情,从 SQL 中获取数据,将其放在 excel 上,转换为 PDF,压缩并将其放入响应中
看起来是这样的……
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition",
string.Format("attachment; filename=\"{0}.zip\"", QuestionnaireName));
Response.WriteFile(FilePathZip);
所以我希望完成,但不幸的是,在我刷新我的回复之前关闭带有.gif 的模式......我不知道该怎么做
ScriptManager.RegisterStartupScript(this, this.GetType(),
"CloseModal", "Closepopup();", true);
Response.Flush();
Closepopup 函数只是简单的函数
function Closepopup() {
$('#GenerateReport_modal').modal('hide');
}
所以在漫长的代码之旅之后,我的问题出现了,我得到了下载文件对话框,我的模态仍然启动并在后台运行。而且我完全不知道如何解决它,如何在执行 Response.Flush() 之前从代码中隐藏模式?
感谢您的帮助,我为文字墙道歉
【问题讨论】:
标签: javascript c# twitter-bootstrap