Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GridView.DefaultRelationIndex Property

Gets or sets the index of a detail view (detail tab) to process by default.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.2.dll

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

#Declaration

[DefaultValue(0)]
[DXCategory("Behavior")]
public virtual int DefaultRelationIndex { get; set; }

#Property Value

Type Default Description
Int32 0

A zero-based integer that specifies the index of a detail view processed by default.

#Remarks

Views can have multiple detail views. The DefaultRelationIndex property specifies the index of a detail view (detail tab) to open when a user expands a master row.

Default Relation Index - WinForms Data Grid

/* The advBandedGridView1 view has two detail views: gridView1, cardView1.
 * The following code makes the cardView1 the default detail view.
 * The grid displays the corresponding detail tab when a user expands a master row.
 */
advBandedGridView1.DefaultRelationIndex = 1;

The DefaultRelationIndex property specifies a detail view processed by the IsMasterRowEmpty(Int32), SetMasterRowExpanded, and CanExpandMasterRow(Int32) methods.

Use the following methods to expand/collapse or get the information about the specified detail view:

Read the following topic for detailed information: Master-Detail Relationships.

See Also