Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [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
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing and Validation
    [Collapse]Export Overview
      Exporting GridView Records
      Exporting Master-Detail Records
   [Expand]Visual Elements
  [Expand]Card View
  [Expand]Vertical Grid
  [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]Pivot Grid
  [Expand]Tree List
  [Expand]Data Editor Extensions
  [Expand]Report Extensions
 [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]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Exporting GridView Records

The ASP.NET MVC GridView extension allows you to export grid records to various format types: CSV, PDF, RTF, XLS and XLSX.

This topic explains how to export grid records.

Expanded Overview

The export result is a document of one of the supported formats (e.g., PDF). It can be saved on the server side or downloaded by an end-user.

To save the export result on the server side, use one of the following methods (depending on the required file format).

To send the export result to an end-user as a file for download, use one the following methods (depending on the required file format).

All of the methods listed above require the grid settings (i.e. an object of the GridViewSettings type) and an object to which the grid is bound. To avoid a repetitive declaration and initialization of grid settings, it is recommended that you declare grid settings in the Controller code (or any other helper code) and pass them to the View code. In the example below, the grid settings are declared within the Controller code and can be retrieved via static methods.

The grid settings can contain export specific settings.

Expanded Example

The code sample below demonstrates how to implement the export of grid records.

Controller code:

View code("Index"):

Partial View code ("_GridViewPartial"):

Expanded See Also

How would you rate this topic?​​​​​​​