How can I display the progress of an ASP. NET page that has been loaded for a long time in a client browser? Add the loading prompt in the page_load event...
Introduction: using system. Threading;
In the page_load event, enter:
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 = 'Loading page'; DOTS ++; If (DOTS> = dotmax) DOTS = 1;");
Response. Write ("For (VAR X = 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 = 'Ddn ';");
Response. Write ("Window. clearinterval ();}");
Response. Write ("Startshowwait (); </SCRIPT> ");
Response. Flush ();
Thread. Sleep (20000 );
On the. ASPX page, enter
<script>HideWait();</script>
From: http://blog.sina.com.cn/s/blog_4efce4d10100cimv.html