I have an asp.net webform with an update panel and some code-behind event handlers to handle partial postbacks. In such events, Sys.WebForms.PageRequestManager.getInstance.add_endRequest method is executed as it should once the page is partial-rendered by browser.
The problem is, when I put Response.Redirect line in code-behind in one of these events, the Sys.WebForms.PageRequestManager.getInstance.add_endRequest event do not execute. Due to this, the busy animation keep showing after the page completes execution.
In particular, my code-behind event handler redirect user to a file, this effectively results in browser downloading that file. As long as that file is an image file the whole thing works correctly as the image is shown in the same window of browser. The problem arises when the file is a ms office file that browser wants to open in ms office. The user clicks “open” or “save” in the dialog box and file is opened in ms office or save in file system, but the page stays in busy state because Sys.WebForms.PageRequestManager.getInstance.add_endRequest is not executed.
The problem’s to do with the requests being partial page requests. Because they’re downloading files there’s no benefit gained by making them partial. Instead, I’d make the ‘buttons’ trigger full post backs, either by adding them as PostBackTriggers or programmatically using the RegisterPostBack method of the ScriptManager.