views:

154

answers:

4

I have a number of asp.net AJAX update panels on a page, that can be refreshed independantley. I would like it so that when the refresh button is used, the content in the panel is hidden, and only the loading image is displayed while data is fetched (it takes 5-10 seconds for data to come back from the server). What is the best way to achieve this?

+1  A: 

Is the loading image placed at the same location as the updatepanel?

If thats the case just make the loading panel cover the whole updatepanel.

Richard L
+1  A: 

Use CSS to set the "display" property to none while loading, and set it back to "inline" or "block" when your values are returned from the AJAX panel.

Chris Ballance
+1  A: 

You can use JavaScript to hide/show the panel on the begin and end functions of the RequestHandler:

var panel = new Sys.UI.Control($get("myUpdatePanel"));

function beginRequestHandler(sender, args) {            
    panel.set_visible(false); 
}

function endRequestHandler(sender, args) {
    panel.set_visible(true); 
}
Chris Pebble
+1  A: 
<div class="overlay">
<img src="/...." alt="Loading" />
<div class="your_content">

</div>
</div>

You can set z-index of your_content to value less than overlay z-index after you get complete event, you could set all values to default range.

omoto