How to delay page redirect?

G

gnewsgroup

In my web application, an authenticated user can edit a lot of
personal information and then finally can click on Update/Save button
to save the info.

I did it using MultiView. When the Update or Save button is clicked,
I would like to bring up a View of the MultiView which only displays
the update progress with a spinner like this one:

http://www.mpire.com/images/sunbox_spinner.gif

And some text to the right saying something like "Your profile is
being updated...."

I would like this UpdateProgress view to stay for 5 seconds and then
either redirect to the very 1st view or output something like "Your
profile has been updated."

I was trying this through System.Threading.Thread.Sleep(5000) in the
button click handler, only to realize that http protocol is stateless,
and thus it won't work.

Right now, I am using the asp:UpdateProgress control just next to the
Update button. But, it's not nice enough.

So, if I don't wanna redirect to a different page where one can use
meta page refresh property to set the delay timemout, what can we do?
 
N

Nick Chan

i wrote a custom UpdateProgress which is transparent and displays on
top of everything in UpdatePanel.
using System.Threading.Thread.Sleep and then output some javascript. I
don't see why Sleep won't work


in the custom updateprogress, i register the script

Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(....

and

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(.....

when init, the control will get the updatepanel dimensions and
position. endrequest will tell my control to execute the function
required to display the progress bar or spin gif.
 
G

gnewsgroup

i wrote a custom UpdateProgress which is transparent and displays on
top of everything in UpdatePanel.
using System.Threading.Thread.Sleep and then output some javascript. I
don't see why Sleep won't work

in the custom updateprogress, i register the script

Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(....

and

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(.....

when init, the control will get the updatepanel dimensions and
position. endrequest will tell my control to execute the function
required to display the progress bar or spin gif.

Nick,

Thank you so much, but do you mind giving us more details? Especially
you left out the parameters for initializeRequest and endRequest.

Also, where do you really register the script? You said it is in the
custom UpdateProgress control. I am not sure what it is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top