New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

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.

C#
	
Response.WriteFile("~/Your_File");
	        

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:

C#
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

In this article
See Also
Not finding the help you need?
Contact Support