This is a migrated thread and some comments may be shown as answers.

File download from ajaxified grid

1 Answer 73 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 28 Nov 2008, 11:33 AM
Hi,

I have a LinkButton which is embedded in a NestedView of a RadGrid which is Ajax enabled (using an AjaxManagerProxy).
On click on the LinkButton a file should be downloaded. This is the code I use for download:
Response.Clear(); 
Response.AddHeader("Accept-Ranges""bytes"); 
Response.AddHeader("Connection""Keep-Alive"); 
Response.AddHeader("Content-Disposition""attachment; filename=" + doc.FileName); 
Response.AddHeader("Content-Length", doc.FileSize.ToString()); 
Response.ContentType = doc.MimeType; 
Response.BinaryWrite(doc.Content.ToArray()); 
Response.End(); 
 
This code works perfectly if the grid is not ajax enabled. Is there a way to make it working in an ajax enabled grid?
Many thanks in advance for any suggestions.

Best regards,
Robert

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Nov 2008, 12:05 PM
Hi Robert,

Download and Upload functionality cannot work using AJAX calls. This is a limitation of the XmlHttpRequest component, used in all AJAX frameworks for asynchronous calls to the application. In order to download or upload a file your application must perform a full page postback.

Greetings,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Robert
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or