Welcome Guest Search | Active Topics | Sign In | Register

Performing Action After User Cancels ProgressBar Options
Tim Sygitowicz
Posted: Wednesday, January 19, 2011 12:42:50 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2010
Posts: 2
Hi, I have a developer's license for your (2010) suite and I am using your ProgressBar & CallbackPanel in a manner very similar to the 'Server Side Task - Advanced 2' demo and everything works great except for one thing:

If the user cancels the process (vs the process ending normally), I need something to happen besides just stopping the ProgressBar. The User needs to be informed that the process was indeed canceled. The process I am performing is very lengthy and the progress will be very slow, so when the user clicks the cancel button, they could be waiting for quite some time before they can confirm that the progress was indeed canceled.

When the process completes, the application continues with the next task(s) as it should, the only problem I am having is I need to perform some task (client side or server side) automatically upon cancelling the process.

Can you please let me know how I might accomplish this?

Thanks,
Tim Sygitowicz
eo_support
Posted: Wednesday, January 19, 2011 1:05:12 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

When user cancels the progress bar, the IsStopped property of the ProgressBarTaskEventArgs is updated to true. So you will need to check that periodically in order to properly cancel your task. Note that you must poll this value. There is no event callback mechanism for canceling a progress bar.

There is no built-in way for you to automatically perform some tasks after the progress bar is canceled. One possible solution is to use your own Cancel button, then write code to call the progressBar's stopTask inside that button's click handler to stop the progress bar. After calling the progressBar's stopTask, you can then call some additional code to perform your additional task. However please keep in mind:

1. You can not do a post back/redirect immediately after calling stopTask. This is because internally stopTask does a post back in order to notify the server that the task has been requested to stop. Posting back or redirecting would unload the hosting page thus affect that post back. If you need to do a post back/redirect, you can delay the call with a timer so that the progress bar post back will have enough time to complete;

2. Calling stopTask merely send out a notification to the server "requesting" the task to stop. Whether your server side code checks for this (by checking IsStopped property) and actually stops your task is a different thing. As such you can not assume that your task has already been stopped after stopTask has been called;

Hope this helps.

Thanks!
Tim Sygitowicz
Posted: Wednesday, January 19, 2011 3:16:00 PM
Rank: Newbie
Groups: Member

Joined: 10/8/2010
Posts: 2
Thank you. Your answer was exactly what I needed to know. Works great now, thanks.
eo_support
Posted: Wednesday, January 19, 2011 3:24:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Great. Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.