Adding an animated gif while a slow page is loading is a fairly straightforward, but in ASP.NET when you do a postback the animated gif will freeze. To get around this you need to reset the image src oclient side after the postback has occured, which can be done using the setTimeout command. Add OnClientClick="loadImg();" to the button loading the slow page and add this markup to the same page:
<img id="loading" src="/images/loading.gif" alt="" style="display:none;"/>
<script type="text/javascript">
function loadImg() {
document.getElementById('loading').style.display = "";
setTimeout('document.images["loading"].src="/images/loading.gif"', 200);
}
</script>
<img id="loading" src="/images/loading.gif" alt="" style="display:none;"/>
<script type="text/javascript">
function loadImg() {
document.getElementById('loading').style.display = "";
setTimeout('document.images["loading"].src="/images/loading.gif"', 200);
}
</script>