New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Download Files with an Ajaxified Control When Using the AjaxManager


Product Progress® Telerik® UI for ASP.NET AJAX AjaxManager


How can I download files with an ajaxified control with the Telerik AjaxManager?


The XmlHttpRequest does not allow you to use the normal response.WriteFile function for invoking the download for a file from an AJAX-enabled control, which is either placed in the RadAjaxPanel or ajaxified by the RadAjaxManager.



To work around this issue, use the ResponseScripts collection of the Telerik AJAX controls to change the location header and to download the file. In the following example, the ResponseScripts collection will be executed after the Ajax request completes.

RadAjaxPanel1.ResponseScripts.Add(String.Format(@"window.location.href = ""{0}"";", ""));

RadAjaxPanel1.ResponseScripts.Add(String.Format("window.location.href = ""{0}"";", ""))

See Also

In this article