This is a migrated thread and some comments may be shown as answers.

Options to cancel an Ajax'd search?

1 Answer 19 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
toddhd
Top achievements
Rank 1
toddhd asked on 17 Feb 2011, 08:13 PM
I have a search page, and the results grid is AJAX'd using the ProxyManager.

The problem I have is this - sometimes, if the user enters very broad search terms, the search can take a very long time, or even time out. In these cases, I want to be able to cancel the search (after the search is already in progress).

I've been searching on the web and on these forums all day, and I think the short answer to my question is - you can't cancel an AJAX request once it's been started. If that is true, then my next step is to look for some workaround or alternative.

Right now we are attempting to simply reload the page, but is throwing an error:
An unknown error occurred while processing the request on the server. The status code returned from the server was: 0

I am assuming this error is being displayed because we are trying to refresh the page while the AJAX request is still running. Does that seem correct?

Do you have any ideas on how I can make this error go away, or perhaps some other idea on how to get around the problem of not being able to cancel the search?

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 23 Feb 2011, 10:25 AM
Hello,
 

Note that by design ASP.NET AJAX Framework cancels the ongoing Ajax request if you try to initiate another one prior to receiving the response from the first one. This is the only possible way to cancel one ongoing request. I'm not completely sure if the presented error is caused by processing a new request during Ajax request. Could you please post some code from your markup and the related code behind so we could further investigate the issue?


Greetings,
Maria Ilieva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Ajax
Asked by
toddhd
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or