Edit this page

Download Files with Ajaxified Control

If you want to invoke download for a file from an AJAX-enabled control (either placed in RadAjaxPanelor ajaxified by RadAjaxManager ), you cannot use the normal response.WriteFile function.



Why? Because the XmlHttpRequest cannot handle this.

Instead you can use the ResponseScripts collection of the RadAjax controls to change the location header and download the file:

RadAjaxPanel1.ResponseScripts.Add(String.Format(@"window.location.href = ""{0}"";", "http://yoursite.com/Your_File"));

RadAjaxPanel1.ResponseScripts.Add(String.Format("window.location.href = ""{0}"";", "http://yoursite.com/Your_File"))

The ResponseScripts collection will be executed after ajax request completes.

See Also

Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article