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

Built-in Export

  • 4 minutes to read


The information in this topic applies to DevExpress ASP.NET Grid View versions 17.2 and later.

ASPxGridView provides the following tools for implementing data export: toolbar commands, context menu items, client-side and server-side API.


The built-in toolbar/context menu export commands and client-side API are disabled by default due to possible security issues. To enable this functionality, set the ASPxGridExportSettings.EnableClientSideExportAPI property to true.

Toolbar Commands

The ASPxGridView toolbar provides the following export commands.

Use the GridViewToolbarItem.Command property to specify a toolbar item’s export command.

Refer to the Toolbars topic or Toolbar online demo for more information on grid toolbars.

<dx:ASPxGridView ID="Grid" runat="server" KeyFieldName="ProductID" DataSourceID="ProductsDataSource" Width="100%">
    <dx:GridViewToolbar EnableAdaptivity="true">
                <dx:GridViewToolbarItem Command="ExportToXls" />
                <dx:GridViewToolbarItem Command="ExportToXlsx" />
                <dx:GridViewToolbarItem Command="ExportToCsv" />


Context Menu Items

ASPxGridView provides the context menu’s Export submenu with the following items. Set the GridViewExportMenuItemVisibility.Visible property to true to display the Export submenu.

Item Item’s Visibility Member Command Name
Export to PDF GridViewExportMenuItemVisibility.ExportToPdf GridViewContextMenuCommand.ExportToPdf
Export to RTF GridViewExportMenuItemVisibility.ExportToRtf GridViewContextMenuCommand.ExportToRtf
Export to DOCX GridViewExportMenuItemVisibility.ExportToDocx GridViewContextMenuCommand.ExportToDocx
Export to CSV GridViewExportMenuItemVisibility.ExportToCsv GridViewContextMenuCommand.ExportToCsv
Export to XLS GridViewExportMenuItemVisibility.ExportToXls GridViewContextMenuCommand.ExportToXls
Export to XLSX GridViewExportMenuItemVisibility.ExportToXlsx GridViewContextMenuCommand.ExportToXlsx

Refer to the Context Menu topic or Context Menu online demo for more information on the grid’s context menu.


Export API

Execute a client or server export method (see the Member Table: Built-in Export) to implement grid data export.

The following code samples illustrate how to use client and server export methods.

  • Client API

    <dx:ASPxGridView ClientInstanceName="grid" ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
    <SettingsExport EnableClientSideExportAPI="true" />
    <br />
    <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Export">
        <ClientSideEvents Click="function(s, e) {
        }" />
  • Server API

    switch(e.Item.Name) {
        case "CustomExportToXLS":
            grid.ExportXlsToResponse(new DevExpress.XtraPrinting.XlsExportOptionsEx { ExportType = ExportType.WYSIWYG });
        case "CustomExportToXLSX":
            grid.ExportXlsxToResponse(new DevExpress.XtraPrinting.XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });

The ASPxGridViewDetailSettings object provides the following export settings:




Specifies whether you can expand several master rows simultaneously.


Specifies the detail view’s position among other views in a printed document.


Specifies whether the grid export mode.


Specifies whether the grid displays detail buttons.


Specifies whether the grid displays detail rows.

You can customize exported grid element appearance with the ASPxGridView.StylesExport property.


The ASPxGridView cannot export data columns that are hidden or export template content. If the grid is in a GridViewTemplates.DetailRow template, ASPxGridView allows you to export both master and detail data.

Note that templated elements are exported with their default representation. For instance, if you export a grid with templated cells, they are represented as default labels with text in the obtained file.

Excel Data Aware Export

When you export data in XLS and XLSX formats, the following grid data is maintained in the resulting excel document.

  • Data grouping with the ability to collapse/expand groups within a worksheet.
  • Data sorting and filtering.
  • Totals and group summaries with the ability to modify/change formulas.
  • Format conditions with the ability to modify/change conditional formatting rules.
  • Data validation for combo-box columns.
  • Fixed columns.

See the following Knowledge Base Article for more information: ASPxGridView / MVC GridView Extension - Excel Data Aware Export FAQ.


The grid ignores custom text specified in the CustomColumnDisplayText event handler when it exports content to an XLSX and XLS format. If you need to provide custom cells’ text in exported document, handle the ExportRenderBrick event.

Export Limitations

Data Aware Mode Limitations

Use the WYSIWYG (What You See Is What You Get) export mode to avoid the specified limitations. Note, however, table formatting is lost in this mode.

ASPxGridView1.ExportXlsxToResponse(new XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });

Online Demos

Exporting to Different Formats

Excel Data Aware Export

Export Selected Records

Export Master-Detail Records

Export with Format Conditions

Export with Data Cell Bands

Context Menu

Member Table

Task-Based Help