This article could be of assistance for you.
The key part of the HTML elements is as follows:
<span id='myHiddenDiv' style='display: none'>
<img src='' id='myAnimatedImage' align='absmiddle'>
</span>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" OnClientClick="showDiv();" Text="Search" />
We have a hidden span (it could be a div, if you want it on a new line), and inside this span is our img tag. Next, in the OnClientClick handler of our button, we call the "showDiv();" client script function which looks like so:
<script language='javascript'>
function showDiv()
{
document.getElementById('myHiddenDiv').style.display ="";
setTimeout('document.images["myAnimatedImage"].src="work.gif"', 200);
}
</script>
This uses the setTimeout method to make the DOM reset the src property of the image after 200ms. The result is that when you press your button that kicks off your long - running method, the image will show and continue animating until the postback returns and the page is reloaded, whereupon the image disappears -- exactly the behavior we want.