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

How to display group aggregations in group headers

3 Answers 238 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Konrad
Top achievements
Rank 1
Konrad asked on 19 Nov 2010, 04:11 PM
I would like to ask how I can add aggregations to group expressions so that the group headers in  RadGrid display aggregated values.
For example I want to display all count of grouped elements but not in group footer. In custom paging.
And how to display grouped elements on others page. beacuse now it shows grouped  elements per page not whole table.
All in custom paging :)

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Nov 2010, 11:34 AM
Hello Konrad,

For your first requirement, you can use custom code to calculate the count and set it as GroupHeader like below.

C#:
int count = 0;
 
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
   foreach (GridGroupHeaderItem groupHeader in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
    {
       GridItem[] children = groupHeader.GetChildItems();
       count=  children.Count();
       groupHeader.DataCell.Text = "Count=" + count.ToString();
       count = 0;
    }
}

And for the second requirement, as far as I know it is not possible to group the items on other pages. For more information on this please go through the following forum post.
Rad Grid Group and Paging Index

Thanks,
Princy.
0
Konrad
Top achievements
Rank 1
answered on 22 Nov 2010, 12:30 PM
For the first, thank you.:)
For the second, I mean that I would like to have text Group continues on the next page. beacuse, I use now custom paging and it groups elements only per page.
According to this example you just disable custom paging while grid is sorted or grouped.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx
0
Nikolay Rusev
Telerik team
answered on 25 Nov 2010, 10:44 AM
Hello Konrad,

I am not sure whether I understand your requirements correctly, but here is what RadGrid performs when grouping.

First it requires the whole data source(all records) in order to perform grouping. After the grouping is finished then paging is performed. Thus grouping is performed on all items regardless whether they are on current page or not.

However in case of custom paging - developer is responsible for supplying the data and if only page size items are set as DataSource of RadGrid it will perform grouping only those items.

Regards,
Nikolay
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Konrad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Konrad
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or