After enabling AJAX, it's pretty easy to declaratively add an animated image using the UpdateProgress control from the Toolkit controls and an animated gif image. This post assumes you already know how to enable AJAX in your module, if not refere to this previous post.
After enabling AJAX in DNN in any of the two ways detailed in the mentioned post, add an Update panel with a Label and a button control.
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label">asp:Label><br /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />ContentTemplate>asp:UpdatePanel>
Add the UpdateProgress control to your .ascx file and set the AssociatedUpdatePanel property value to the Update Panel ID of the UpdatePanel you want it to be associated to:
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">asp:UpdateProgress>
In the Progress Template element add an Image control with its ImageUrl property value pointing to your animated image.
<ProgressTemplate><asp:image id="updating1" Imageurl="~/DesktopModules/MyModule/Images/LoadingIcon.gif" runat="server"/>ProgressTemplate>
The final markup should look like this:
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><asp:image id="updating1" Imageurl="~/DesktopModules/MyModule/Images/LoadingIcon.gif" runat="server"/>ProgressTemplate>asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label">asp:Label><br /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />ContentTemplate>asp:UpdatePanel>
The best part about working with declarative programming is that you will not need to recompile your code.