asp.net: annimated gif while stored proc runs in the background

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

ASP.NET: Any suggestions on how to display an animated .gif file on a web
page while a stored procedure is running in the background? For example, on
some of the airline sites, it asks you to wait while a reservation is being
placed. During that time that the process is running on the server, they
frequently show some sort of graphic that implies "don't touch anything -
we're working."

The problem:
If I post a page with the graphic, but in the same piece of code I execute
the stored proc, the page doesn't actually display the graphic until the
stored procedure is completed, which defeats the purpose. It's feels like I
need to display the graphic, then magically force yet another postback??

Thanks in advance!

Mark
 
Mark said:
ASP.NET: Any suggestions on how to display an animated .gif file on a web
page while a stored procedure is running in the background? For example, on
some of the airline sites, it asks you to wait while a reservation is being
placed. During that time that the process is running on the server, they
frequently show some sort of graphic that implies "don't touch anything -
we're working."

The problem:
If I post a page with the graphic, but in the same piece of code I execute
the stored proc, the page doesn't actually display the graphic until the
stored procedure is completed, which defeats the purpose. It's feels like I
need to display the graphic, then magically force yet another
postback??

You can:

- Have a hidden frame which actually does the stored proc work and
then returns some type of code in a javascript variable. In your
main frame, have your animated gif and a Javascript timer that
checks the other frame to see if that variable is set yet

- Spawn a thread to do the DB work and then have your page redirect
to the "Progress" page which immediately checks to see if the work
is done. If not, it waits (while the gif is running on the client)
and refreshes every X seconds. On the refresh, the page again checks
the status of the thread. If it's ready, it redirects to the DONE
page, if not, it starts the cycle again.

This might be bad because if you had lots of users, that's lots of
threads, but I've seen it done before and it seems to work well.

There's a 3rd one that I'm missing and it's pretty good, but
I can't remember it right now. If it comes to me again, I'll repost.

-c
 
Back
Top