How to display Progress bar while page is loading
<pre>
<code>
protected void Page_Load(object sender, EventArgs e)
{
showPageLoad();
//do somthing
{
showPageLoad();
//do somthing
}
private void showPageLoad()
{
int i=0;
Response.Write(“<div=’divTitle’>Loading(<span id=’message’>0%</span>)</div>”);
Response.Flush();
for(i=5;i<=100;i=i+5)
{
System.Threading.Thread.Sleep(200);// any codes can be typed here
outputflash(i.ToString() + “%”);
Response.Flush();
}
}
private void removePageLoad()
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), “deleteLoading”, “var d = document.getElementById(‘divTitle’);d.parentNode.removeChild(d);”, true);
private void showPageLoad()
{
int i=0;
Response.Write(“<div=’divTitle’>Loading(<span id=’message’>0%</span>)</div>”);
Response.Flush();
for(i=5;i<=100;i=i+5)
{
System.Threading.Thread.Sleep(200);// any codes can be typed here
outputflash(i.ToString() + “%”);
Response.Flush();
}
}
private void removePageLoad()
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), “deleteLoading”, “var d = document.getElementById(‘divTitle’);d.parentNode.removeChild(d);”, true);
}
private void outputflash(string value)
{
Response.Write(“<scriptpe=’text/javascript’>document.getElementById(‘message’).innerHTML='” + value + “‘;</script>”);
private void outputflash(string value)
{
Response.Write(“<scriptpe=’text/javascript’>document.getElementById(‘message’).innerHTML='” + value + “‘;</script>”);
}
</code></pre>
No comments:
Post a Comment