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

RadGrid Export to Excel

3 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 18 Oct 2013, 02:29 PM
Hi;

I was looking at the demo site, and there is a 'Export to Excel' method not the (Export to word/excel/pdf or Export to ExcelML). What is the code behindwhen I click on the Export icon, I don't see code is the DefaultCS.aspx.cs code?, also why can't I export to a .xlsx format?

Thanks in advance
Dan Plocica

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Oct 2013, 06:06 AM
Hi Daniel,

The "Export To Excel" by default has the Excel format as BIFF . It is based on a binary XLS (BIFF) format and is supported in all versions of Microsoft Office, starting from 2003.

Can you try setting the FileExtension=".xlsx" to export to a .xlsx format.

ASPX:
<ExportSettings Excel-FileExtension=".xlsx">
</ExportSettings>

Thanks,
Princy
0
Daniel
Top achievements
Rank 1
answered on 21 Oct 2013, 12:33 PM
Thanks for the excel answer, but I still would like to know the code behind whe I click the export to excel icon. I created an app with a grid and the export to excel, but when I click on export nothing happens, so I think I'm missing some code.

Thanks,
Dan
0
Princy
Top achievements
Rank 2
answered on 22 Oct 2013, 03:50 AM
Hi Daniel,

I suppose you have ajaxified your grid. The exporting feature of the control work with regular postbacks only. Once the grid is ajaxified, it should be cancelled before exporting.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
  <ClientEvents OnRequestStart="onRequestStart"></ClientEvents>
      . . . . . . .
</telerik:RadAjaxManager>

JS:
function onRequestStart(sender, args) {
  if (args.get_eventTarget().indexOf("btnExport") >= 0)
    args.set_enableAjax(false);
}

Also check the following help documentation which explains the same.
Export from Ajaxified Grid

Thanks,
Princy
 
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Share this question
or