New to Telerik UI for WinForms? Download free 30-day trial

Iterating Cells

To iterate thought the cells in RadPivotGrid you should first retrieve all row and column groups. This will allow you to create a loop and get all cells values for example:

Iterating Cells


var rowGroups = radPivotGrid1.PivotGridElement.GetRowGroups();
var colGroups = radPivotGrid1.PivotGridElement.GetColumnGroups();
foreach (PivotGroupNode col in colGroups)
{
    foreach (PivotGroupNode row in rowGroups)
    {
        if (row.Group != null && col.Group != null)
        {
            var Value = this.radPivotGrid1.PivotGridElement.GetAggregateValue(row.Group, col.Group, false, false);
            Debug.WriteLine("Row = {0} , Column ={1}, Value ={2}", row.Name, col.Name, Value);
        }
    }
}

Using the above approach you can determine if a cell is selected or programmatically select it as well:

Selecting Cells


// Print the values of the selected cells.
if (radPivotGrid1.PivotGridElement.IsCellSelected(row, col))
{
    var Value = this.radPivotGrid1.PivotGridElement.GetAggregateValue(row.Group, col.Group,false, false);
    Debug.WriteLine("Row = {0} , Column ={1}, Value ={2}", row.Name, col.Name, Value);
}

//Select cell in code
radPivotGrid1.PivotGridElement.SelectCell(row, col, false, true);
In this article