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.2.dll
NuGet Package: DevExpress.Data
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
index | Int32 | An integer value that specifies the index of a master row in the data source. |
relation |
Int32 | An integer value that specifies the relationship. |
#Returns
Type | Description |
---|---|
String | The name of a master-detail relationship. |
#Remarks
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:
- by the IRelationList.RelationCount property, if using the IRelationList interface;
- by the IRelationListEx.GetRelationCount method, if using the IRelationListEx interface.
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.