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

Custom Aggregate & Grouping in telerik Grid

0 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anuj
Top achievements
Rank 1
Anuj asked on 05 Jul 2012, 06:51 PM
protected void gvgrid_CustomAggregate(object sender, GridCustomAggregateEventArgs e)
    {
        if (((Telerik.Web.UI.GridBoundColumn)e.Column).UniqueName == "Actual")
        {
 
            Double intNrvalue = 0;
            Double intDrvalue = 0;
             
 
            foreach (GridDataItem item in gvgrid.MasterTableView.Items)
            {
                
                    intNrvalue += Convert.ToDouble(item["intNumeratorvalue"].Text);
                    intDrvalue += Convert.ToDouble(item["intDenominatorvalue"].Text);
  
            }
 
            double intResult=(intNrvalue / intDrvalue)*100;
            e.Result = intResult;
             
        }
    }
I have a grid that  needs to have a custom aggregate function (for a Grid Bound Column having Aggregate="Custom") such that it need to calculate the Actual by calculating the sum(numerators) / sum(denominators).
Now if we group that grid by dragging one column in the group panel then it should show calculation at the group level(means at group footer). Any help or samples would be appreciated.
E.g. The same functionality is provided for Aggregate="Sum" for a grid bound column by default.When we drag a particular column in a group panel,then it calculates sum at group level in group footer and overall sum at grid footer.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Anuj
Top achievements
Rank 1
Share this question
or