GridView.MasterRowGetChildList Event
Enables you to supply detail data manually.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
[DXCategory("MasterDetail")]
public event MasterRowGetChildListEventHandler MasterRowGetChildList
Event Data
The MasterRowGetChildList event's data class is MasterRowGetChildListEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
ChildList | Gets or sets a detail clone’s record list. |
RelationIndex | Gets the relation index that identifies the affected detail. Inherited from CustomMasterRowEventArgs. |
RowHandle | Gets the handle of the currently processed master row in the current View. Inherited from CustomMasterRowEventArgs. |
Remarks
The MasterRowGetChildList
event is raised when a particular detail is about to be created. The event’s e.RowHandle and e.RelationIndex parameters identify the detail. To supply custom detail data, use the e.ChildList parameter.
Handle the MasterRowGetChildList
event to do the following:
- Substitute the actual detail data with data supplied manually.
- Supply data to details that have no initial data (implement dynamic data loading). In this case, you will also need to handle the GridView.MasterRowGetRelationCount, GridView.MasterRowGetRelationName and GridView.MasterRowEmpty events.
gridView.MasterRowGetChildList += (s, e) => {
e.ChildList = e.RelationIndex == 0 ? SampleData1.GetData().ToList() : SampleData2.GetData().ToList();
};
Note
The MasterRowGetChildList
event may fire multiple times for a single row during an application run. In specific instances, the MasterRowGetChildList
event fires twice when a master row is expanded. If you implement lengthy operations within this event and this affects performance, we recommend you cache data.
Read the following topic for detailed information and examples: Working with Master-Detail Relationships in Code.