对长时间装载的ASP.NET页如何在客户端浏览器中显进度

对于长时间装载的ASP.NET页面如何在客户端浏览器中显示进度?在Page_Load事件里添加正在装载提示。。。

引入:using System.Threading;

在Page_Load事件里输入:

Response.Write("<div id='mydiv' >"); 
        Response.Write(
"_");
        Response.Write(
"</div>");
        Response.Write(
"<script>mydiv.innerText '';</script>");
        Response.Write(
"<script language=javascript>;"); 
        Response.Write(
"var dots 0;var dotmax 10;function ShowWait()");
        Response.Write(
"{var output; output '正在装载页面';dots++;if(dots>=dotmax)dots=1;"); 
        Response.Write(
"for(var 0;x dots;x++){output += '.';}mydiv.innerText  output;}");
        Response.Write(
"function StartShowWait(){mydiv.style.visibility 'visible'; "); 
        Response.Write(
"window.setInterval('ShowWait()',1000);}");
        Response.Write(
"function HideWait(){mydiv.style.visibility 'hidden';"); 
        Response.Write(
"window.clearInterval();}"); 
        Response.Write(
"StartShowWait();</script>"); 
        Response.Flush();
        Thread.Sleep(
20000);

在.aspx页输入

&lt;script&gt;HideWait();&lt;/script&gt;
转自:http://blog.sina.com.cn/s/blog_4efce4d10100cimv.html
原文地址:https://www.cnblogs.com/bicabo/p/1438361.html