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.
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 Components 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)
The source code files for this demo are installed (by default) in the following directory:
Open CS Solution
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxGridViewDemos