views:

27

answers:

1

Hi all

I'm working on an ASP.NET Web Project with some AJAX magic. As my GridView's data needs up to 15 seconds to be gathered, I send the page to the client and fire an asynchronous update of an UpdatePanel via jQuery/JScript (see below).

This works well, so far. Now I'd like to skip this step when the user navigates to the next page (e.g. record detail view) and comes back via the "Back" button. Is there a way to get his, and what's the most elegant one?

This one does not work (hasDonePostBack's value isn't kept by the browser):

var hasDonePostBack = false;
function fRefreshAsyncOnce(id, param) {
    $(document).ready(function() {
        if (!hasDonePostBack) {
            __doPostBack(id, param);
            hasDonePostBack = true;
        }
    });
}

Any help would be great!

The reason why this is important: Regetting the data takes another 15 seconds. Moreover, the grid is working with controls and more client script (e.g. checkboxes that can be checked, CSS classes that are toggled, etc.), and all this should be the same after returning.

Cheers, Matthias

+1  A: 

Hey,

You may want to look at the history point feature; you may be able to take advantage of that for this feature: http://msdn.microsoft.com/en-us/library/cc488548.aspx

However, that is the nature of the beast when triggering client-side operations... the other option is allowing the user to cancel the postback (or try to interpret a way to cancel it yourself) using this technique: http://msdn.microsoft.com/en-us/library/bb398789.aspx

Brian
Thank you Brian, seems like I ought to refactor some parts of my code. I'll have a look at it, then I'll write another post.
Mudu