Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to display animated image till the work in progress.

say,
I am featching data from database it is taking too much time, just i want to display animated image till the data featch.


Help Me...
thanks in adv.....
Posted
Updated 12-Aug-10 21:01pm
v2

Use an UpdateProgress[^] control.
 
Share this answer
 
Comments
PK DotNet 24-Sep-10 7:11am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
Using an UpdateProgress control is the correct option if your page is an Asp.net Ajax enabled page (With UpdatePanel). But, what if you don't use UpdatePanel?

How about a quick easily solution as follows?

C#
protected void Page_Load(object sender, EventArgs e)
{
           Response.BufferOutput = false; //Do not buffer page output. Write response immediately to the browser

           Response.Write(new string(' ', 256)); //Required for IE. 

           Response.Write("Processing...<br />"); //Show a fancy animation here, using an img html element or flash object
           Response.Flush(); //Flush response immediately

           Thread.Sleep(5000); //Mimics the expensive database operation for 5 seconds
           Response.Write("<br />Done."); //Indicate operation is done.
           Response.Flush();
}


When you hit the page in the browser, the "Processing..." will be shown first and after 5 seconds the "Done" message will be shown without any page refresh. The 5 seconds delay is caused due to the Thread.Sleep(5000) and you call your database method here.

Enjoy!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900