3 Answers, 1 is accepted
Setting the OpenInNewWindow property under ExportSettings to true will add the content-disposition: attachment HTTP header to the response with the exported content: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/exporting/overview#properties-and-events. It is important to note that it is up to the browser and end user OS to determine what to do with the file and the content-disposition header is only a suggestion the web app can make, it cannot influence the client OS.
Regards,
Marin Bratanov
Progress Telerik
It appears none of my ExportSettings are working. They did when I first started this project but now stopped and nothing I can do will bring them back. For example, the .FileName does not take and the Excel keeps coming out as html.. This code is pretty straight forward but nothing takes on the ExportSettings.
<
telerik:RadGrid
runat
=
"server"
ID
=
"RadGridAccessList"
CellSpacing
=
"0"
GridLines
=
"None"
CssClass
=
"GridHeightSetAuto"
AllowSorting
=
"False"
AutoGenerateColumns
=
"False"
PageSize
=
"50"
AllowPaging
=
"false"
AllowFilteringByColumn
=
"false"
AllowMultiRowSelection
=
"false"
HeaderStyle-Font-Bold
=
"true"
OnItemDataBound
=
"RadGridAccessList_ItemDataBound"
OnGridExporting
=
"RadGridAccessList_GridExporting"
>
protected void RadGridAccessList_GridExporting(object sender, GridExportingArgs e)
{
loadAccessList(this.PropertyID);
ConfigureExport();
switch (e.ExportType)
{
case ExportType.Excel:
RadGridAccessList.ExportSettings.Excel.Format = GridExcelExportFormat.Biff;
RadGridAccessList.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
RadGridAccessList.MasterTableView.ExportToExcel();
break;
case ExportType.Csv:
RadGridAccessList.ExportSettings.Csv.EncloseDataWithQuotes = true;
RadGridAccessList.MasterTableView.ExportToCSV();
break;
}
}
private void ConfigureExport()
{
RadGridAccessList.ExportSettings.ExportOnlyData = true;
RadGridAccessList.ExportSettings.IgnorePaging = true;
RadGridAccessList.ExportSettings.OpenInNewWindow = true;
RadGridAccessList.ExportSettings.FileName = "AccessList";
}
I advise that you compare the problematic grid with the one in our demos where the approach of changing the export format works as expected: https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/exporting/excel-export/defaultcs.aspx.
If this does not help you resolve this, I advise that you open a support ticket and send us a runnable page that demonstrates the problem so we can debug it.
Regards,
Marin Bratanov
Progress Telerik