Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Collapse]Master-Detail Relationships
     Master-Detail Overview
    [Expand]Binding to Data Specifics
    [Expand]View Specifics
    [Expand]Row Specifics
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Master-Detail Overview

Grid Control supports master-detail data presentation. This type of data representation requires the presence of at least two data tables - master and detail. These tables are linked by a one-to-many relationship, i.e., a single row in the first table can be related to one or more rows in the second table, but a row in the second table can be related to only one row in the first table. Master and detail tables are also called parent and child tables.

Note that a master-detail mode can be more complex than just two tables linked together. Each master table can be linked to multiple child tables and each child table in turn can be a master of another table and so on. Grid Control allows you to represent master-detail relationships of any complexity.


When pixel-based vertical row scrolling is enabled, the Master-Detail Mode is forcibly disabled. See GridOptionsBehavior.AllowPixelScrolling, to learn more.


Master-detail data presentation is not supported in server mode.

Expanded Online Video

Expanded Views in Master-Detail Mode

Grid Control uses views to display data from a bound data source. Views are special objects that specify how data should be displayed on screen.

The following screenshot shows a grid control displaying two master-detail relationships. A master table is linked to detail tables by the "Supplier ID" field. The master table in the image below is represented by an Advanced Banded Grid View. The details are represented by a Grid View and Card View respectively.

The top level master table in a bound data source is represented by a top level view called MainView. You can access this MainView using the GridControl.MainView property. Expanding master rows open detail Views called clones. All clone Views for the same master-detail relationship are created based upon a single View - the pattern. The pattern View is just a template for all detail Views (clones), which are displayed when master rows are expanded.

Pattern Views used to represent master-detail relationships (e.g., child tables) can be defined at design time using the Level Designer or at runtime using the GridControl.LevelTree property. It is also possible to provide pattern Views for particular details dynamically by using a grid's master-detail events. The Detail Pattern and Clone Views document provides more information on Views in a master-detail mode.

Each master row can have multiple master-detail relationships. To allow an end-user to switch between details, you can enable detail tabs or detail tooltips.

Each detail View can be maximized to fit an entire grid control. This allows you to temporarily remove the other details and the master View to focus on a particular detail. For more information, refer to the Zooming Views section. The Expanding and Collapsing Master Rows document shows how to open and access detail Views in code.

The GridControl.ShowOnlyPredefinedDetails property allows you to control which master-detail relationships can be displayed in the grid. This property is set to false by default, and Grid Control fetches and displays all master-detail relationships in the data source. If the GridControl.ShowOnlyPredefinedDetails property is set to true, the grid will only display the relationships that are referred to by the GridControl.LevelTree. Other relationships will not be displayed.

Expanded Data Sources

To bind a grid control to a data source, utilize the GridControl.DataSource and GridControl.DataMember properties.

  • The Master-Detail: DataTable Use document shows how to implement master-detail relationships for .NET data structures (System.Data.DataTable, System.Data.DataSet) by means of data sources. Once you bind such a data source to a grid control at design time, a hierarchical structure of master-detail relationships is obtained from the data source and is shown by the Level Designer, and this helps you assign and customize pattern Views for the relations.

    When using this approach, detail data always resides in memory. For large detail tables, this can affect the application's performance. So, in this case, a better method to set up master-detail relationships is either to implement the IRelationList interface or to handle the grid's master-detail events.

  • The Master-Detail: Implementing Master-Detail Relationships for Custom Objects document provides information on implementing a master-detail mode for data source objects.
  • The Master-Detail: Using Events document describes a grid's master-detail events in order to implement dynamic detail loading. This method can be used regardless of the data source type and it allows you to provide efficient use of memory similar to the IRelationList Interface.
It is possible to combine all these methods to implement a master-detail mode depending on your particular needs. For instance, you can provide detail data by implementing the IRelationList interface while supplying Views for representing this data using events, etc.

Expanded See Also

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