Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Collapse]Views
    How to: Access Objects Selected in the Current View
    How to: Access the Master Object from a Nested List View
    How to: Create and Show a Detail View of the Selected Object in a Popup Window
    How to: Detect a Lookup List View in Code
    How to: Display a Detail View Directly in Edit Mode in ASP.NET Applications
    How to: Display a List View as a Chart
    How to: Display Several Views Side-by-Side
    How to: Hide Collection Properties in an Edit Mode Detail View for an ASP.NET Application
    How to: Implement a Singleton Business Object and Show its Detail View
    How to: Implement a View Item
    How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Access the Master Object from a Nested List View

When implementing a Controller for a nested List View representing an object collection, you may need to access the master object. This topic demonstrates how to do this, using the Person and Task business classes from the BCL as an example.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E950.

To associate a collection of Task objects with Contact objects by the One-to-Many relationship, we will modify these classes in the following manner

If you run an application that contains these classes, the MyPerson Detail View will look like this:

Assume that you need to access the Detail View's current MyPerson object from a View Controller that is activated for the nested List View. In this instance, use the List View's Collection Source. Its type is PropertyCollectionSource, because the List View represents a collection property. To access the master object, handle the PropertyCollectionSource.MasterObjectChanged event and use the PropertyCollectionSource.MasterObject property. The following Controller accesses the master object if the Collection Source of the current View is of the PropertyCollectionSource type and the object type of the current View is MyTask.

Expanded See Also

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