hi, I have a web site where user provide some search criteria and click on button "Search". I want to provide a "Cancel" button which user can click. In case search takes long, user clicks on Cancel and he remains on the same page without any result. basically i want to provide the option of cancelling a request already fired or not wait for result of already fired request. I want to do this on client side.
I have tried sample provided on Microsoft site by using PageRequestManager.getinstance(), but it is very slow. http://asp.net/AJAX/Documentation/Live/tutorials/CancelAsyncPostback.aspx
Even in this sample, clicking on cancel does not immediately cancel the query.There is time lag which is almost the same time as when normal response comes back. If I click Cancel, I would expect that search to cancel and same page to get reloaded faster.
Please help me, this is urgent.
Thanks
Seehttp://mattberseth.com/blog/2007/06/aspnet_ajax_canceling_an_async_1.html
-Damien
Thanks Damien for providing link
It's really helpful
Hi,
I did some research, but I couldn't find anyone complaining about this issue.
As far as I know, the simplest way to cancle a AyncPostback is to use PageRequestManager.getinstance()(http://asp.net/AJAX/Documentation/Live/tutorials/CancelAsyncPostback.aspx), I nerver heard anyone complain that it is too slow.
I don't think there is a better way by now.
So please double check your code.
Best Regards,
Hi Jin,
Thanks for providing the link. I have used Sys.WebForms.PageRequestManager.getInstance().abortPostBack() in my code to cancel the asyn postback. I think it gets cancelled but the problem is that since request is still executing at server, anything that i now do on my application becomes very slow like loading another page or something. and after a few seconds everything returns to normal. this is probably because requests are getting queued at server...
Tirath.g@.hotmail.com:
I think it gets cancelled but the problem is that since request is still executing at server, anything that i now do on my application becomes very slow like loading another page or something. and after a few seconds everything returns to normal
I believe you are correct.
You can try to use the UpdateProgress control to "blank" out the screen while the process is occuring which may stay while the cancel is in progress. You can make the UpdateProgress "modal" so that it blanks out the page; there is an example here:http://blogs.visoftinc.com/archive/2007/09/10/modalupateprogress.aspx
-Damien
1 comment:
Probably too lat for this answer to be relevent but just in case for the next reader...
I don't use the AJAX framework but I do believe it is build around XMLHttpRequest. So search to see if it has the abort functionality. If not, see if there is a way to get ahold of the XMLHttpRequest instance and call XMLHttpRequest.abort(). That will cancel the request clientside and ignore the response from the server.
Post a Comment