在导出数据至Excel时,有时数据会比较大,响应的时间会比较长,想做一个提示进度条,在点击导出数据按钮进,进度条显示出来,在数据导出完毕并成功弹出保存对话框时,进度条自动隐藏起来,但现在有个问题,点击导出时能显示进度条,在弹出文件保存对话框时,进度条不能隐藏,经调试是:
//查询数据代码(略)....
Response.ContentType = "application/ms-excel";
Response.AppendHeader("Content-Disposition", "attachment;filename=info.xls");
Response.BinaryWrite(File.ReadAllBytes(strNowPath));
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "", "<script>HideOverLayer();</script>");//隐藏进度条
执行这三条语句后,Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "", "<script>HideOverLayer();</script>");这条语句执行之后在前台没有响应,求解决方法。。。
<style type="text/css">
body{ font-size:12px;}
.divExportProcess{
width: 208px;height: 20px;text-align: center;z-index: 999; background-color:White;
left: 50%;
top: 50%;
margin-left: -104px !important;
margin-top: -10px !important;
margin-top: 0px;
position: fixed !important;
position: absolute;
display: none;
}
</style>
<script type="text/javascript">
//show div
function ShowOverLayer() {
$("#overbgDiv").fadeIn();
$("#divExportProcess").fadeIn();
}
//closed div
function HideOverLayer() {
$("#overbgDiv").fadeOut();
$("#divExportProcess").fadeOut();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="btnExport" runat="server" Text="导出数据" _disibledevent="btnExport_Click" _disibledevent="ShowOverLayer();" />
<div id="divExportProcess" class="divExportProcess"><img src="images/load_bar.gif" alt="loading" />数据导出中...</div>
</form>
</body>
</html>
确认注册的脚本已经下页面执行了吗?
HideOverLayer 这个方法也能晒出来吗?
....