Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Expand]Common Concepts
  [Collapse]Grid View
    Overview - GridView
    Main Features - GridView
   [Collapse]Concepts
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing and Validation
    [Collapse]Exporting
      Built-in Exporting
      Custom Exporting
   [Expand]Visual Elements
   [Expand]Member Tables
   [Expand]Examples
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]HTML Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Navigation and Layout Extensions
  [Expand]File Management
  [Expand]Multi-Use Site Extensions
  [Expand]Charts
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Tree List
  [Expand]Data Editor Extensions
  [Expand]Report Extensions
  [Expand]SpellChecker
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Built-in Exporting

Supported Versions

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

The ASP.NET MVC GridView extension allows exporting its data to a file or stream in CSV, DOCX, PDF, RTF, XLS, and XLSX format.

MVCxGridView data exporting can be implemented using standard toolbar commands and the server and client API.

Requirements

Follow the instructions below to ensure the exporting functionality works correctly:

  • Exporting using the built-in toolbar commands and client-side API is disabled by default due to possible security issues. To enable this functionality, set the MVCxGridExportSettings.EnableClientSideExportAPI property to true.
  • The GridView extension should be inside the <form> form.
Refer to the KA18639 knowledge base article to get more information on exporting GridView rows while retaining end-user modifications (such as sorting, grouping, filtering, selection).

  • Standard toolbar commands

    The MVCxGridView toolbar provides frequently used grid commands, including exporting commands. Specify a standard grid exporting command (listed below) using the GridViewToolbarItem.Command property setting. Refer to the Toolbar online demo for more information on using grid toolbars.

  • Context menu commands

    The MVCxGridView allows exporting its data using the context menu commands. Use the GridViewSettings.FillContextMenuItems event to add an Export item. To process the Export item click, handle the client-side ASPxClientGridView.ContextMenuItemClick and server-side ASPxGridView.ContextMenuItemClick events. Refer to the Context Menu online demo for more information on using the grid's context menu.

  • Exporting API

    Execute an appropriate client method to implement grid data exporting. See Member Table: Built-in Export for a list of available methods.

    The following example illustrates how to use client exporting methods:

Expanded Export Master-Detail Records

The MVCxGridView's master-detail records can be exported using the standard toolbar commands or client API which are listed above and in the Member Table: Built-in Export topic.

Declare the master grid settings (a GridViewSettings type object) and an object the grid is bound to. We recommended declaring grid settings in the Controller code (or any other helper code) and passing them to the View code to avoid repeatedly declaring and initializing grid settings.

The master grid settings should contain export-specific settings and a delegate method assigned to the MVCxGridViewExportSettings.GetExportDetailGridViews property. Using this delegate method adds a bound to data detail grid to the GridViewExportDetailRowEventArgs.DetailGridViews collection.

Expanded Example

The code sample below demonstrates how to export the grid's master-detail records.

Note

Refer to the Export Master-Detail Records online demo to see this feature in action and review the full code sample.

Controller code:

Partial View (Master Grid):

Partial View (Detail Grid):

GridViewExportHelper:

Expanded Online Demos

Expanded Member Table

Is this topic helpful?​​​​​​​