The following code works nicely:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
function InitializeRequest(sender, args) {
document.body.style.cursor = 'progress';
}
function EndRequest(sender, args) {
document.body.style.cursor = 'default';
}
</script>
When the response returns an attachment, though (a PDF from the ReportViewer control, for instance):
Response.AddHeader("Content-Disposition", "attachment; filename=some.pdf")
EndRequest() never fires and the "progress" cursor is not reset. A Javascript call, e.g.
ScriptManager.RegisterStartupScript(this, this.GetType(), "close",
"parent.EndRequest(...);", true);
would do the trick, but is not possible because of the content disposition. Can you think of a way to do this correctly - show a wait cursor while a PDF is rendered, and return to the normal cursor when the PDF is displayed? I am assuming a C# context here, but the problem is not language- or platform-specific.