Echo URL

Parent Previous Next

By default, we use the downloadify library to generate the file on the client and save it on disk. However, since downloadify depends on flash player, in environments without the flash plugin, we depend on a server echo mechanism. You can choose to only use the server echo if you want consistent behavior. You can do so by setting grid.excelOptions.enableLocalFilePersistence=false;

Here is how that works:

When you do a export (or pdf - more on that later), we basically build a string on the client  application. Since a browser without Flash player cannot write to your hard drive (except cookies and such), we need to go through the traditional http File Buffering process. So what we do is this : We build the excel/word/html string, and send it to the server, which simply writes it back, in addition to setting the content type. Now, we advise that you implement your own url to buffer this string back, but do provide our own url - the one mentioned above to perform the buffering. The server side code for this is very simple:

//This is C# code, you could just as easily do the same thing in Java or PHP or whatever it is that sits on your server.

           var extension = Request["extension"];

           var contentType = Request["contentType"];

           var body= Request["body"];


           Response.AddHeader("content-disposition", string.Format("attachment; filename=Download.{0}",extension));

           Response.ContentType = contentType;



And then the final part, of letting the DataGrid know that you have your own server url.

To do this, just set grid.exportOptions.echoUrl=yourUrl;