Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[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]Export Overview
      Exporting GridView Records
      Exporting Master-Detail Records
   [Expand]Visual Elements
   [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]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]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Exporting Master-Detail Records

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

This topic explains how to export master-detail 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 of the following methods (depending on the required file format).

All of the methods listed above require the master 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 master and detail grid settings are declared within the Controller code, and can be retrieved via static methods.

The master grid settings should contain export-specific settings and a delegate method assigned to the MVCxGridViewExportSettings.GetExportDetailGridViews property. This delegate method should add a bound to data detail grid to the GridViewExportDetailRowEventArgs.DetailGridViews collection (see the GetMasterGridSettings action method within the Controller code in the example below).

Expanded Example

The code sample below demonstrates how to implement the export of master-detail records.

Controller code ("HomeController"):

View code ("Index"):

Partial View (Master Grid):

Partial View (Detail Grid):

Expanded See Also

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