views:

597

answers:

2

I have a page that displays a gridview with some checkboxes and drop-down lists to filter the results. However, the trip to the database to get the data that the gridview binds to can be lengthy.

I tried methods from various examples of in-process "Updating..." messages but they all seem to be for postbacks. Things like animated "Processing..." panels that are done Gmail-uploading style, etc - but I need something that works when the page is loading for the first time.

It's pretty simple ASP.NET (up to 3.5) with a little bit of AJAX and VB code-behind.

Any solution for this page has to be 'modular' enough that it can be implemented on other pages that are going to be FAR more complex later on in this project's life.

A: 

You would probably be best served by loading the page's content (sans grid), then making a remote call to kick off the lengthy retrieval process. Here is an article that can help you with the deferred loading bit. To enable the progress bar on a global (page) level, you can do something like this:

$(document).ready(function() {
$.ajaxStart(function() { $(".progressBar").show();});
$.ajaxStop(function() { $(".progressBar").hide();});
});

EDIT: forgot to mention that my example as well as Dave Ward's post are done using jQuery!

Josh E
A: 

You could use asp:UpdateProgress, but you may find that it is somewhat limited on more complex pages. It's very easy to implement though.

smercer