<p>This is probably a simple question but how can I best use an AJAX loader in ASP.NET to provide a loading dialog whilst the page is being built?</p>

<p>I currently have an UpdatePanel with an associated UpdateProgressPanel which contains the loading message and gif in a ProgressTemplate. </p>

<p>Currently I have a page that onLoad() goes and gets the business entities and then displays them. While it is doing this I would like to display an AJAX loader. </p>

<p>Would it be better to have nothing in the page load and have a hidden button that is triggered onLoadComplete or unLoad() which would then wait for the button click method to complete displaying the UpdateProgressPanel? </p>

You can do it in HTML outside of .Net.  In your ASPX page you have code like:
```
<div id="loading">
<!-- Animated GIF or other indication that stuff is happening -->
</div>
```
At the very bottom of your page, right before the  you can have a code snippet that looks like this:
```
<script language="javascript">
document.getElementById("loading").style.display = "none";
</script>
```
The graphic--- as long as it's at the top of the page--- will render first.  Then all of your onLoad stuff will happen, and finally the inline JavaScript will happen last since it's at the bottom of the page.
A lot of times I'll disable the buttons in their unloaded state and enable them in that bottom JavaScript too.  That prevents the user from getting click happy and triggering events before the page is ready.