The DevExpress ASP.NET MVC Grid View supports master-detail data presentation of any complexity.
This demo shows how to create a simple master-detail relationship between two tables. All you have to do is to:
- Use two Grid View extensions.
- Bind the first grid (master grid) to the master data source and enable the grid's SettingsDetail.ShowDetailRow option.
- Place the second grid (detail grid) into the master grid's detail row template created via the SetDetailRowTemplateContent method.
- Assign a unique (dynamically generated) name to the Name property of the detail grid and set its SettingsDetail.MasterGridName property to the master grid's name.
- Bind the detail grid to the detail data source whose data is retrieved in a controller action based upon the corresponding master row ID passed via a ViewData parameter.
By default, end-users can expand several master rows simultaneously. This behavior is controlled by the SettingsDetail.AllowOnlyOneMasterRowExpanded option.