Back to Devexpress

GridView.MasterRowEmpty Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-c34e7539.md

latest4.9 KB
Original Source

GridView.MasterRowEmpty Event

Enables you to specify whether a particular detail is empty. This event is in effect if the GridOptionsDetail.AllowExpandEmptyDetails option is set to false.

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 MasterRowEmptyEventHandler MasterRowEmpty
vb
<DXCategory("MasterDetail")>
Public Event MasterRowEmpty As MasterRowEmptyEventHandler

Event Data

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

PropertyDescription
IsEmptyGets or sets a value specifying whether a detail contains data.
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 MasterRowEmpty event is in effect if the GridOptionsDetail.AllowExpandEmptyDetails option is set to false. The Grid control fires this event for each master-detail relationship for each master row within the View. Handle the MasterRowEmpty event to do the following:

  • Mark a detail View that contains data as “empty” by setting the event’s e.IsEmpty parameter to true.

  • Mark a detail View that does not contain data as “not empty” by setting the event’s e.IsEmpty parameter to false. In this case, data for this View needs to be provided via the GridView.MasterRowGetChildList event.

  • C#

  • VB.NET

csharp
gridView.MasterRowGetRelationCount += (s, e) => {
    e.RelationCount = 2;
};

gridView.MasterRowEmpty += (s, e) => {
    e.IsEmpty = false;
};
vb
AddHandler gridView.MasterRowGetRelationCount, Sub(s, e) e.RelationCount = 2

AddHandler gridView.MasterRowEmpty, Sub(s, e)
    e.IsEmpty = False
End Sub

Users cannot access empty detail Views, either with detail tabs, or with detail tooltips (the visibility of these elements is specified by the event’s e.IsEmpty parameter).

Read the following topic for detailed information and examples: Working with Master-Detail Relationships in Code.

Run Demo: Master-Detail Mode with Events

See Also

MasterRowGetChildList

MasterRowGetLevelDefaultView

MasterRowGetRelationCount

MasterRowGetRelationName

Working with Master-Detail Relationships in Code

GridView Class

GridView Members

DevExpress.XtraGrid.Views.Grid Namespace