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
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
    [Collapse]Master-Detail Relationship
      Master-Detail: Implementation
      Expanding and Collapsing Detail Rows
     Appearance Customization
     Adaptivity
     Save and Restore Layout
    [Expand]Templates
     Export
     Toolbars
    [Expand]ASPxGridLookup
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [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

Master-Detail: Implementation

In this document you will learn how to use ASPxGridView to display master-detail data. Data is obtained from the Categories and Products tables in the NWind database. The Categories table is the master, while Products is a detail table. A master-detail relationship is established through the CategoryID field.

  1. Retrieve Data From the Database
  2. Create Master and Detail ASPxGridViews
  3. Set up a Master-Detail Relationship

Expanded 1. Retrieve Data From the Database

To retrieve data from the database, use the AccessDataSource components:

  • Master: Categories

  • Detail: Products. Define a filter rule (see the image below).

Expanded 2. Create Master and Detail ASPxGridView

Create two ASPxGridView controls. Bind the first grid (master) to the dsCategories. Bind the second grid (detail) to the dsProducts. Specify data source key fields for both grids using their ASPxGridBase.KeyFieldName property.

Expanded 3. Set up a Master-Detail Relationship

Invoke ASPxGridView's Template Designer by clicking the Edit Templates task. Select the DetailRow template.

Drag the detail grid onto the Detail Row template.

Handle the ASPxGridBase.BeforePerformDataSelect event to specify session values.

When finished, select the End Template Editing task and enable the master grid's ASPxGridViewDetailSettings.ShowDetailRow option.

The image below illustrates the result.

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