This is a migrated thread and some comments may be shown as answers.

Edit GrandTotalColumns in RadPivotGrid

1 Answer 124 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 2
Luis asked on 27 May 2014, 10:59 PM
Hi everyone,

I have 3 ​PivotGridAggregateField, the first is a quantity, second is a price, and third is a ​CalculationExpression, a multiplication between quantity and price. The problem i have, is in Grand Total Column, because the first and second grand total columns are ok, but third grand total column not, the result in this grand total column, is a multiplication between quantity grand total column and price grand total column. Can i edit this values or hide any grand total column or failing, edit aggregate functions in grand total columns?...

Thks.....

Best regards. 

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 30 May 2014, 11:01 AM
Hello Luis,

You could change the value of the GrandTotal cell on CellDataBinding event handler. Basically you have to check whether the currently cell is of type PivotGridDataCell and whether the cell is GrandTotalCell.  Additionally you could check the parent row and col indexes and this way to find whether the cell is the one which you want to modify. Please check out the following code snippet.
protected void RadPivotGrid1_CellDataBound(object sender, Telerik.Web.UI.PivotGridCellDataBoundEventArgs e)
{
    if (e.Cell is PivotGridDataCell)
    {
        PivotGridDataCell cell = e.Cell as PivotGridDataCell;
        string parentRowIndex = cell.ParentRowIndexes[0].ToString();
        string parentColIndex = cell.ParentColumnIndexes[0].ToString();
        if (parentRowIndex == "Black" && parentColIndex == "Grand Total" && cell.IsGrandTotalCell)
        {
            cell.Text = "New Value";
        }
    }
}

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PivotGrid
Asked by
Luis
Top achievements
Rank 2
Answers by
Kostadin
Telerik team
Share this question
or