Skip to main content

GridView.GetRowSummaryItem(Int32, GridColumn) Method

Returns a key-and-value pair representing the summary item and its value calculated for a particular group footer cell.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v23.2.dll

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

Declaration

public virtual DictionaryEntry GetRowSummaryItem(
    int rowHandle,
    GridColumn column
)

Parameters

Name Type Description
rowHandle Int32

An integer value specifying a group row handle. This identifies the group whose footer contains the desired cell.

column GridColumn

A GridColumn object (or descendant) representing the column where the desired cell resides.

Returns

Type Description
DictionaryEntry

A DictionaryEntry object whose key is the summary item and value is the summary value. An empty dictionary entry if the specified row footer cell doesn’t have the corresponding summary item.

Remarks

The returned dictionary entry is an element of the hashtable returned by the GridView.GetGroupSummaryValues method. The entry’s key is a GridGroupSummaryItem object representing the summary item. The value is an object holding the calculated summary value.

To obtain the summary text displayed within a particular row footer cell, use the GridView.GetRowFooterCellText method.

Please refer to the Working with Summaries in Code. Custom Summaries topic for additional information.

Note

Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the GetRowSummaryItem member must not be invoked for these Views. The GetRowSummaryItem member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.

Example

The following code demonstrates how to use the GridView.GetRowSummaryItem method to obtain a summary displayed in a specific cell of the group footer corresponding to the focused group row.

using DevExpress.XtraGrid.Views.Base;

private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) {
    GridView currentView = sender as GridView;            
    // Obtain the summary item displayed in the focused column 
    // within the focused group row's footer   
    DictionaryEntry ent = currentView.GetRowSummaryItem(e.FocusedRowHandle, 
      currentView.FocusedColumn);
    // Determine whether the summary item for the specified row and 
    // column is successfully obtained
    if(ent.Key != null) {
        GridGroupSummaryItem si = (GridGroupSummaryItem)ent.Key;
        // Obtain the summary item's text
        this.Text = si.GetDisplayText(ent.Value, true);
    } else {
        this.Text = "There is no summary for this row and column";
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetRowSummaryItem(Int32, GridColumn) 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