New to Telerik UI for WinUIStart a free 30-day trial

Async Export

Updated on Mar 26, 2026

Telerik DataGrid supports export to PDF, Excel and CSV formats. The control allows also asynchronous export which executes on a background thread, thus avoid freezing the main thread.

The async export supports the same features as the standard export, but it provides few additional events and also it requires slightly different output stream management. To use this feature, call the ExportAsync method of RadDataGrid.

Using the ExportAsync method

C#
string projectRootFolderPath = System.IO.Path.GetFullPath("../../../../../../", AppDomain.CurrentDomain.BaseDirectory);
FileStream stream = File.Open(projectRootFolderPath + "\\" + "SampleDocument.xlsx", FileMode.OpenOrCreate);
this.dataGrid.ExportAsync(stream, ExportFormat.Xlsx);     

The Stream object provided to the stream parameter of the method will be automatically closed and disposed when the export operation finishes.

This type of export reports progress. The AsyncExportProgressChanged event of RadDataGrid is raised each time a row is exported. The event can be used to check the current progress and display additional information to the user, if needed.

Listening for exporting progress changed

C#
private void RadDataGrid_AsyncExportProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
	int progress = e.ProgressPercentage;
}

The AsyncExportCompleted event of RadDataGrid is raised when the export finishes. The event arguments contain information about the export state (was it cancelled and is there an error).

Checking the export for errors

C#
private void dataGrid_AsyncExportCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
	bool cancelled = e.Cancelled;
	Exception? error = e.Error;
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support