I have a RadGrid in an ASP page. The grid is grouped by a column containing organization names. There is also a column containing prices and I want to sum them up in the group footer (and in the grid footer as well). So far so good. I can add Aggregate="Custom" to the column I want to sum.
There is also a column containing checkboxes. I want to exclude the rows where the checkbox is checked. So instead I add Aggregate="Custom" to the column and OnCustomAggregate="rg_CustomAggregate" on the grid. Now I need to implement this method rg_CustomAggregate but I'm struggling with how to actually browse through the rows in order to sum the price in the rows with the unchecked checkboxes.
The base for the method looks like this so far:
protected
void
rg_CustomAggregate(
object
sender, GridCustomAggregateEventArgs e)
{
int
sum = 0;
if
(e.Item
is
GridGroupFooterItem)
{
// TODO: The magic.
e.Result = sum;
}
if
(e.Item
is
GridFooterItem)
{
// TODO: Som other magic.
e.Result = sum;
}
}
Any tips on how the magic should be implemented is gladly accepted. I have had a hard time finding examples of this on the web.