[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Expand]Controls and Libraries
 [Collapse]Scaffolding Wizard
   Getting Started
  [Expand]Overview
  [Expand]Data Access Layer
   UI Generation
  [Collapse]Examples
    How to: Create a Custom Filter
    How to: Add a New Detail Collection
    How to: Show Validation Errors when IDataErrorInfo is Used
    How to: Show Detail Views in Separate Windows
    How to: Implement Many-to-many Relations Editing
    Entity Names Autogeneration
    How to: Use Projections to Create Custom Queries and Optimize Performance
    How To: Improve Performance by Using the Instant Feedback Mode
  [Expand]Tutorials
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Add a New Detail Collection

This document describes how to add a new detail collection to an application generated with the DevExpress Scaffolding Wizard. It supports editing detail collections (one-to-many relations). If such collections exist in a data source, the master object's panel will contain additional GridControl controls displaying child objects.

This topic contains the following sections.

The complete sample project (the result of this current tutorial) is available at:

Expanded Task Details

In this topic, you will extend this example: http://www.devexpress.com/example=T322553. The example is built in the context of the UI Generation (Code First) tutorial.

The data model in this example contains the Department table.

The Department table contains the Courses detail collection, which is shown in the UI.

This tutorial describes how to add a new detail collection into the Department table - Employees. The resulting UI is shown below.

Expanded Extend Model

Add the Employees property to the Department class.

Expanded Regenerate ViewModels and Views

Now, when the model is updated, you can regenerate ViewModels and Views.

Open the Template Gallery.

Run the Scaffolding Wizard and follow its steps.

In the finish dialog, you can select which ViewModels and Views should be regenerated. In the current scenario, you need to select the ViewModel and View for the Department entity, and also all ViewModels and Views for related entities.

Expanded Result

If you run the application, you will see the Employee detail view has been added to the Department editing form.

Is this topic helpful?​​​​​​​