Last Updated: 18 Nov 2021 06:36 by ADMIN
Scheduled for 3.1.0
Created on: 28 May 2020 13:47
Category: Grid
Type: Feature Request
Include all pages in Excel export should work with OnRead

With OnRead, AllPages cannot be exported because the grid Data only has the current page:

If you are using the OnRead event, only the current page of data will be exported, because that's all the grid has at the time of the export action.


I load my data via "OnRead", because i need to implement pagination by myself, and I would like the export option to work with that too.

Posted on: 29 Jul 2021 16:03

Here's my workaround for this. If somebody really needs a full example I'm sure I can whip up a quick razor page, or maybe Marin can take this and build a full example. But this should be enough for anybody to work off of.

First thing I do is get the datagrid's current state.  Then I build a DataSourceRequest off of that.  For the page size, I set it to the total number of records that exist.  I can then send that request off to the same service that I am using to populate the data grid.  I can then build my own excel document using the library of my choice, and I'm sure this can easily be done with Telerik Document Processing library.  I'm using SpreadSheetLight (

var state = this.dataGridRef.GetState();
DataSourceRequest req = new();
req.Filters = new List<IFilterDescriptor>(state.FilterDescriptors.OfType<IFilterDescriptor>());
req.Sorts = new List<SortDescriptor>(state.SortDescriptors);
req.PageSize = this.TotalRecords;

DataSourceResult dsr = await this.dataService.GetSomeData(req);
var dataToExport = dsr.Data as IEnumerable<SomeDataModel>();

// Build your excel export using the library of your choice
SLDocument excelDoc = new();
int row = 1;
foreach(var record in dataToExport)
    excelDoc.SetCellValue(row, 1, record.Value1);
    excelDoc.SetCellValue(row, 2, record.Value2);

// You need to then convert the excel to a Base64String needed to download the file
// The SLDocument.SaveAs method accepts a stream as a destination so I'm writing to a memory stream instead of to a file

string b64ExportData;
using(MemoryStream outStream = new())
    var exportRaw = outStream.ToArray();
    b64ExportData = Convert.ToBase64String(exportRaw);

// Download the extract once you have the base 64 string. 
// I'm using this javascript function found here which I found here:
await this.JSRuntine.InvokeVoidAsync("saveFile", b64ExportData, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "DataGridExport.xlsx");


Marin Bratanov
Posted on: 27 Jul 2021 05:12

Hello Meindert,

The only workaround I can offer is generating the export entirely in the application code, you can find a sample here:

Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

Posted on: 26 Jul 2021 10:17
Would be functional if this item is solved/implemented. Is there a workaround?
Posted on: 04 Jun 2021 13:03

I agree, this would be really useful.

Also useful if you could set a MAX number of records, this could ensure the export is not too big.

Posted on: 21 May 2021 07:01
Its a very useful feature. Request Telerik to work on it.