Tab

ASPxGridViewExporter Class

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.1.dll

Declaration

public class ASPxGridViewExporter :
    ASPxGridExporterBase
Public Class ASPxGridViewExporter
    Inherits 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.20.1: Data & Analytics toolbox tab in the Microsoft Visual Studio IDE.

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

NOTE

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: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

Examples

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