Skip to main content

IRelationList.GetRelationName(Int32, Int32) Method

When implemented by a class, returns the name of a master-detail relationship.

Namespace: DevExpress.Data

Assembly: DevExpress.Data.v24.1.dll

NuGet Package: DevExpress.Data


string GetRelationName(
    int index,
    int relationIndex


Name Type Description
index Int32

An integer value that specifies the index of a master row in the data source.

relationIndex Int32

An integer value that specifies the relationship.


Type Description

The name of a master-detail relationship.


This method is called in turn for each relationship for each master row. You should handle it to provide the names for master-detail relationships. The names will be used to identify the master-detail relationships in other method and event calls.

The relationIndex parameter specifies a value between 0 and RelationCount - 1, where RelationCount is the number of relationships for the currently processed row. The number of relationships is identified:

When implementing a data source for a GridControl, the names retrieved via the GetRelationName method are used to obtain the default pattern Views used to represent the detail data. The pattern Views are retrieved from the GridControl.LevelTree tree. At design time, you can use the Level Designer to associate pattern Views with specific relationship names. If you handle the GetRelationName method but there isn’t any pattern View associated with the supplied relationship’s name, the grid will use the current master View as the pattern for representing detail Views. The name retrieved is also displayed in detail tabs and detail tooltips, if these are enabled. If you need to customize the display names, you can use the BaseView.ViewCaption property or implement the IRelationListEx interface, and handle its IRelationListEx.GetRelationDisplayName method.

See Also