Back to Devexpress

GridView.MasterRowGetChildList Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-75c2d701.md

latest4.9 KB
Original Source

GridView.MasterRowGetChildList Event

Enables you to supply detail data manually.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("MasterDetail")]
public event MasterRowGetChildListEventHandler MasterRowGetChildList
vb
<DXCategory("MasterDetail")>
Public Event MasterRowGetChildList As MasterRowGetChildListEventHandler

Event Data

The MasterRowGetChildList event's data class is MasterRowGetChildListEventArgs. The following properties provide information specific to this event:

PropertyDescription
ChildListGets or sets a detail clone’s record list.
RelationIndexGets the relation index that identifies the affected detail. Inherited from CustomMasterRowEventArgs.
RowHandleGets 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:

csharp
gridView.MasterRowGetChildList += (s, e) => {
    e.ChildList = e.RelationIndex == 0 ? SampleData1.GetData().ToList() : SampleData2.GetData().ToList();
};
vb
AddHandler gridView.MasterRowGetChildList, Sub(s, e) e.ChildList = If(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.

See Also

MasterRowEmpty

MasterRowGetLevelDefaultView

MasterRowGetRelationCount

MasterRowGetRelationName

Working with Master-Detail Relationships in Code

GridView Class

GridView Members

DevExpress.XtraGrid.Views.Grid Namespace