We have 20 declared columns (NOT using auto-generated columns) and the user can use the context menu to group by any column and have nested groupings. The default is no grouping. I set the Aggregate="Count" property on the primary ID databound field. The counts get displayed in the footer but I want to display them in the header next to the header text. Also the catch with this approach is that if that column is hidden (user can decide which columns to view), the totals do not show up. I simply want to add a count of the number of records/items that are in each group.
I tried using ItemDataBound checking for GridGroupHeaderItem but all of the AggregatesValues for the item are null.
Here is what I've tried in the itemdatabound event.
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridGroupHeaderItem)
{
GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
int
c1 = item.GetChildItems().Length;
//always 0
int
c2 = item.GetChildItems().Count()
//always 0
}
}