waiting

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I have a search page that takes a long time to load, about 1 min.
How can I prompt the user with a 'please wait' and a progress bar right
after the user submit the search words?

Thanks
Aaron
 
Hi,

Perform the search during rendition process using threads.

protected override void Render(HtmlTextWriter writer)
{
System.Threading.Thread t = new System.Threading.Thread(SearchMethod);
t.Start();

writer.Write("Please wait...");

while(t.IsAlive)
{
writer.Write(".");
writer.Flush();

Page.Response.Flush();

System.Threading.Thread.Sleep(500);
}
}
 
Thanks for a link. Nice articel indeed.

Brock Allen said:
Beware of this solution as it consumes a thread from the thread pool for
the entire minute. This will cause performance problems in your
application if you also have moderate load. You might want to look into
some of the other solutions or take the idea of this approach below but
make it an async page. Fritz Onion describes this:

http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Back
Top