GridView.MasterRowGetRelationName Event
Enables you to specify the pattern view that will represent a particular detail clone.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v18.1.dll
Declaration
[DXCategory("MasterDetail")]
public event MasterRowGetRelationNameEventHandler MasterRowGetRelationName
Event Data
The MasterRowGetRelationName event's data class is MasterRowGetRelationNameEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
RelationIndex | Gets the relation index that identifies the affected detail. Inherited from CustomMasterRowEventArgs. |
RelationName |
For the GridView.MasterRowGetRelationName event this property gets or sets the name of the level whose bound View will be used to represent the currently processed detail’s data. For the GridView.MasterRowGetRelationDisplayCaption event this property gets or sets the display caption for the currently processed relation. |
RowHandle | Gets the handle of the currently processed master row in the current View. Inherited from CustomMasterRowEventArgs. |
Remarks
The MasterRowGetRelationName event is raised for individual detail clones. The current clone can be identified using the event’s CustomMasterRowEventArgs.RowHandle and CustomMasterRowEventArgs.RelationIndex parameters. Use the MasterRowGetRelationNameEventArgs.RelationName parameter to specify the View that will represent the current detail. This parameter should be set to the name of the relationship which is associated with the required View in the GridControl.LevelTree tree. The grid control will locate the required View using the name of this relationship and will use this View to represent the current detail clone.
The MasterRowGetRelationName event should be handled in the following cases:
- when you need to specify the pattern View for individual detail clones. For instance, the master View can have a single child relation. You can handle the MasterRowGetRelationName event to represent detail clones corresponding to different master rows using different Views;
- when you provide detail data dynamically. Please refer Working with Master-Detail Relationships in Code document for additional information regarding this.
If you need to provide a View that doesn’t belong to the GridControl.LevelTree tree, handle the GridView.MasterRowGetLevelDefaultView event instead.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the MasterRowGetRelationName event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.