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.
Local Copy of this Demo To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer. |
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxGridViewDemos |