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

Export button does not work in IE8

14 Answers 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 22 Aug 2011, 10:41 AM
SOS!
I suddenly bumped into weird problem. When I click export button (pdf, excel) on my grid - I am getting this:



Everything works properly in other browsers and in IE9...

14 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Aug 2011, 11:38 AM
Hello Alexander,

Please take a look into the following article which explains the similar issue.
Internet Explorer is unable to open Office documents from an SSL Web site.

Thanks,
Shinu.
0
Alexander
Top achievements
Rank 1
answered on 22 Aug 2011, 11:52 AM
Hi, Shinu.

Uhhm... I have not checked such approach, but I cannot use ViewState in any case, because I use client-side grids and receive data via web-services: i call web-service, get data from the db, save it in session and when i click export button - data is retrieved from the session... :(
0
Mira
Telerik team
answered on 24 Aug 2011, 04:16 PM
Hello Alexander,

Please note that exporting with client-side binding is not supported, RadGrid should be bound server-side, otherwise you will receive an empty file.

You can refer to this help topic for additional information.

Regards,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Alexander
Top achievements
Rank 1
answered on 25 Aug 2011, 08:55 AM
Greetings,

yes, I know this. I use postback for exporting and get data, that is stored to session in webservice call, it works in general and data is ok.
The problem concerns only IE8, because of this security stuff, as I am being told...
0
Mira
Telerik team
answered on 30 Aug 2011, 12:52 PM
Hello Alexander,

I assume that the issue is caused by using the export feature over SSL and Internet Explorer.
Please try adding the following lines just before the exporting:
RadGrid1.Page.Response.ClearHeaders();
RadGrid1.Page.Response.Cache.SetCacheability(HttpCacheability.Private);

If the problem persists, you can toggle the value of the OpenInNewWindow property.

I hope this helps.

Greetings,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Paul
Top achievements
Rank 1
answered on 03 Jul 2012, 02:32 PM
I am experiencing this same problem.  I have added the 2 lines to clear the headers and SetCacheability(HttpCacheability.Private) to no avail.  Also, I tried toggling the OpenInNewBrowser flag and that did not work either.  
0
Mikhail
Top achievements
Rank 1
answered on 04 Jul 2012, 08:30 AM
Hello.
We have the  same issue. Please help resolve this problem. We use provided by you two lines, but problem still exists.
0
Daniel
Telerik team
answered on 05 Jul 2012, 09:09 AM
Hello Mikhail,

Please try using the same code in the GridExporting event.

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Mikhail
Top achievements
Rank 1
answered on 05 Jul 2012, 09:55 AM
When we use this code 
Reportgrid.Page.Response.ClearHeaders();
           Reportgrid.Page.Response.Cache.SetCacheability(HttpCacheability.Private);
in Reportgrid.GridExporting error not appear but content goes to client not like xls file but like html page and shows in IE window. 
0
Daniel
Telerik team
answered on 06 Jul 2012, 12:10 PM
Hi guys,

Alternatively you could try the workarounds provided by Microsoft here:
Internet Explorer file downloads over SSL do not work with the cache control headers

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Paul
Top achievements
Rank 1
answered on 09 Jul 2012, 05:46 PM
I am unable to use Microsoft's workarounds.  They involve Registry edits and this is a client-facing website.  When I add the 2 lines to the OnGridExporting event, the text is displayed in the browser as a web page instead of a download.  Are there any other solutions to this problem?
0
Mikhail
Top achievements
Rank 1
answered on 10 Jul 2012, 07:03 AM
In my case, workarounds provided by Microsoft helped. We exporting grid to Excel. When you using this code:
Reportgrid.Page.Response.ClearHeaders();
Reportgrid.Page.Response.Cache.SetCacheability(HttpCacheability.Private);

you clear Reportgrid.Page.Response.ContentType, try to set it. In my case:
Reportgrid.Page.Response.ContentType = "application/vnd.ms-excel";

This helped for me. When file downloaded and if client use Ms Office 2003-07 all ok but if client use Office 2010 client take error to open downloaded file.
0
Paul
Top achievements
Rank 1
answered on 10 Jul 2012, 05:08 PM
I was able to get this working by inserting the following lines in the GridExporting event handler:

ActivityGrid.Page.Response.ClearHeaders();
ActivityGrid.Page.Response.Cache.SetCacheability(HttpCacheability.Private);
  
ActivityGrid.Page.Response.ContentType = "text/csv; name=\"filename.csv\"";
ActivityGrid.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=\"filename.csv\"");
0
Ralf
Top achievements
Rank 1
answered on 17 Apr 2013, 11:16 AM
Hi,

we had the same problem in a SharePoint context. The grid is placed in a ASP UpdatePanel and the export button outside for postback.
The following code solved the problem for us:

private void _gridViewContent_GridExporting(object sender, GridExportingArgs e)
{
    if (HttpContext.Current.Request.IsSecureConnection
        && HttpContext.Current.Request.Browser.Type.ToUpper().Contains("IE")
        && HttpContext.Current.Request.Browser.MajorVersion < 9)
    {
        _gridViewContent.Page.Response.ClearHeaders();
        _gridViewContent.Page.Response.Cache.SetCacheability(HttpCacheability.Private);
        _gridViewContent.Page.Response.ContentType = "application/vnd.ms-excel";
        _gridViewContent.Page.Response.AddHeader("Content-Disposition", "attachment;filename=SearchResults.xls");
    }
}


Hope this help someone.

Regards,
Ralf
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Alexander
Top achievements
Rank 1
Mira
Telerik team
Paul
Top achievements
Rank 1
Mikhail
Top achievements
Rank 1
Daniel
Telerik team
Ralf
Top achievements
Rank 1
Share this question
or