Skip to main content
A newer version of this page is available. .
Tab

ASPxGridViewExporter Class

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

public class ASPxGridViewExporter :
    ASPxGridExporterBase

Remarks

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.19.2: Data & Analytics toolbox tab in the Microsoft Visual Studio IDE.

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

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

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

Important

  • 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.

Concept

ASPxGridView - Custom Export

Example

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

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