Here is an example of a user control that we are using in our application:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UpdatePanelPleaseWaitControl.ascx.cs"
Inherits="AgencijaRSWeb.UserControls.UpdatePanelPleaseWaitControl" %>
<script type="text/javascript">
var errorOccoured = false;
function pageLoad()
{
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest
(
function (sender, args)
{
$find('<%=mpeuProgrss.ClientID%>').show();
}
);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest
(
function (sender, args)
{
if (args.get_error() != undefined)
{
if (errorOccoured == false)
{
alert(args.get_error().message);
errorOccoured = true;
}
}
$find('<%= mpeuProgrss.ClientID%>').hide();
}
);
}
</script>
<toolkit:ModalPopupExtender ID="mpeuProgrss" runat="server" TargetControlID="lblDummy"
PopupControlID="pnlLoading" BackgroundCssClass="modalBackground" DropShadow="true">
</toolkit:ModalPopupExtender>
<asp:Panel ID="pnlLoading" runat="server" CssClass="modalPopup" Style="display: none; width: 550px; min-height: 100px">
<asp:Label runat="server" ID="lblDummy" Style="display: none" />
<div style="font-weight: bold; font-size: 1.2em;">
<div style="display: inline; float: right;">
<asp:Image runat="server" ID="ajaxLoader" ImageUrl="~/images/ajax-loader.gif" />
</div>
<h1 style="margin-top: 0px; padding: 0px; height:25px">
Please wait!
</h1>
<div style="text-align: center">
Your request is being processed.
</div>
</div>
</asp:Panel>
On a target page: put all of your page content inside an update panel and then below update panel add this code:
<uppwc:UpdatePanelPleaseWaitControl runat="server" />
uppwc, is registred like this:
<%@ Register Src="~/UserControls/UpdatePanelPleaseWaitControl.ascx" TagName="UpdatePanelPleaseWaitControl"
TagPrefix="uppwc" %>
Hope this helps!
Regards, Uros