Options to cancel an Ajax'd search?

2 posts, 0 answers
  1. toddhd
    toddhd avatar
    21 posts
    Member since:
    Aug 2006

    Posted 17 Feb 2011 Link to this post

    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?
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 23 Feb 2011 Link to this post


    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?

    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!
Back to Top