« Notable Links | Main | Prayer is not for getting things done »

Show Progress for Long Running ASP.NET page

Posted by: David Carroll

<%@ Import Namespace="System.Threading" %>
<%@Page Language="VB" %>

<html>
<%
Response.Write("<div id='mydiv'>Loading</div>")
Response.Write("<script language=javascript>;")
Response.Write("var dots=0;var dotmax=10;function ShowWait()")
Response.Write("{var output;output='Loading';dots++;if(dots>=dotmax)dots=1;")
Response.Write("for(var x=0;x<dots;x++)output+='.';mydiv.innerText= output;}")
Response.Write("function StartShowWait(){window.setInterval('ShowWait()',1000);}")
Response.Write("function HideWait(){mydiv.style.display='none';window.clearInterval();}")
Response.Write("StartShowWait();</script>")
Response.Flush()
Thread.Sleep(10000)
%>
<head>
<script>HideWait();</script>
</head>
<body>
<h1>Loaded</h1>
</body>
</html>

Comments

Add New Comment