Skip to main content

ASPxGridViewExporter Class

A control that allows exporting the ASPxGridView control’s data.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v22.1.dll


public class ASPxGridViewExporter :


The ASPxGridViewExporter component allows you to export the ASPxGridView’s data to a file or stream in various formats - PDF, RTF, XLSX, XLS, CSV, and DOCX.

The ASPxGridViewExporter control is available on the DX.22.1: Data & Analytics toolbox tab in the Microsoft Visual Studio IDE.

GridViewExporter in Toolbox

Drag the control onto a form and customize the control’s settings, or paste the control markup in the page’s source code.


To properly function, DevExpress controls require that special modules, handlers and options are registered in the the Web.config file. Switch the Microsoft Visual Studio IDE to the Design tab to automatically update the Web.config file with the required DevExpress information.

<dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="ASPxGridView1">

<dx:ASPxGridView ID="ASPxGridView1" runat="server">
ASPxGridViewExporter1.WriteXlsxToResponse(new XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });


  • The ASPxGridViewExporter cannot export hidden data columns and the content of templates unless the GridViewTemplates.DetailRow template contains the ASPxGridView control. The ASPxGridViewExporter can identify a grid within this type of template, and allows you to export both master and detail data.

    The gridview exporter exports the grid’s templated elements with their default representation (without templates). For instance, if you export a grid with templated cells, the exporter ignores the template content and exports cells as default labels with text.

  • Don’t export the ASPxGridView’s content during callbacks, because ASP.NET does not support sending binary content during a callback.
  • Before the exporter exports a grid, the exporter creates an export document on a server. Therefore, when you export a large amount of data to a server with limited memory, the OutOfMemoryException exception can appear.
  • Add the ASPxGridViewExporter to the page’s controls and recreate it on every round-trip to the server if it’s created dynamically.


ASPxGridView - Custom Export


This example uses the ASPxGridBase.ExportPdfToResponse method to export grid data to a file in PDF format.

PdfExportOptions options = new PdfExportOptions();
options.Compressed = false;
See Also