Skip to main content

PivotGridControl.GetRowIndex(Object[]) Method

Returns the index of the specified row.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.2.dll

Declaration

public int GetRowIndex(
    object[] values
)

Parameters

Name Type Description
values Object[]

An array of row field values that identify a row.

Returns

Type Description
Int32

An integer value that specifies the row index. -1 if the specified row has not been not found.

Remarks

Pivot Grid rows are indexed as shown below:

GetRowIndex

If the field value array identifies several rows (this may happen if there are several data fields and the Area option is set to the RowArea value), the GetRowIndex method returns the smallest index. To get the row related to another data field, use the GetRowIndex(Object[], PivotGridField) method overload that allows you to specify a data field.

The following table demonstrates how to get row indices.

C# Visual Basic Return Value
pivotGridControl.GetRowIndex(new object[] {“Beverages”, “Chang”}) pivotGridControl.GetRowIndex(New Object() {“Beverages”, “Chang”}) 0
pivotGridControl.GetRowIndex(new object[] {“Beverages”}); pivotGridControl.GetRowIndex(New Object() {“Beverages”}) 5
pivotGridControl.GetRowIndex(new object[] {}); pivotGridControl.GetRowIndex(New Object() {}) 10

Note that the the method requires the field values, which may be different from the displayed text. The grand total columns has null values.

Tip

To display field values instead of automatically created and formatted strings, handle the FieldValueDisplayText event.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetRowIndex(Object[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also