How do you show master-detail data in a DevExpress grid?

DevExpress Data Grid Intermediate 2–3 Yrs3–5 Yrs Conceptual 1 min read

Quick Answer

Bind the grid to a data source that exposes a parent-child relationship — a DataSet with a relation, or a collection whose items have a child collection property. The GridControl then shows an expand button per master row, and each detail level has its own pattern GridView that formats the child rows.

The grid does master-detail if the data source describes the relationship — either a DataSet with a data relation, or a collection of objects where each object has a child collection like order.Lines. The GridControl picks that up, puts an expand arrow on each parent row, and each detail level gets its own pattern GridView where you set up its columns and summaries separately. If the child data is expensive, I lazy-load it in the master-row-expanding event rather than pulling it all up front.

  • With objects: Order has a Lines property; the grid auto-detects it and creates a detail level.
  • Each level's view (columns, formatting, summaries) is configured independently as a pattern view.
  • MasterRowExpanding / detail-on-demand events let you lazy-load children.
  • For deep or heavy hierarchies, consider a TreeList control instead.