When using the ASP.NET AJAX library I could register a modal async indicator by registering a show method and a hide method with the PageRequestManager.
For example I would place the following code in my master page
<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>
...
<style>
.modalBackground {
background-color: #efefef;
filter: alpha(opacity=70);
MozOpacity: 0.7;
opacity: 0.7;
}
.updateProgress div {
border-width: 1px;
border-style: solid;
background-color: #ffffff;
position: relative;
top: 30%;
text-align: center;
padding: 5px 5px 5px 5px;
}
</style>
...
<asp:Panel ID="pnlUpdateProgress" runat="server"
CssClass="updateProgress"
style="display: none; height: 0;">
<div>
<asp:Image ID="commentViewThrobber" runat="server"
ImageAlign="AbsMiddle"
AlternateText="Please Wait..."
ImageUrl="~/images/throbber-slow.gif"
EnableViewState="false" />
Please wait...
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalProgress" runat="server"
TargetControlID="pnlUpdateProgress"
BackgroundCssClass="modalBackground"
PopupControlID="pnlUpdateProgress" />
And register the following as a startup script:
<script language='JavaScript' type='text/javascript'>
var ModalProgress ='<%= ModalProgress.ClientID %>'
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);
function beginReq(sender, args) {
// shows the Popup
$find(ModalProgress).show();
}
function endReq(sender, args) {
// hides the Popup
$find(ModalProgress).hide();
}
</script>