Telerik Team,
I am having an issue with my GridView control. My goal is to group a grid by a column called "Category", but not show that column in the grid. I then want to show sum aggregates for each group on only certain rows (the number rows). Lastly, I want to show custom numbers in the column footer of my grid (a total sum and a margin calculation).
The problem is that my group aggregates are not appearing.
Here is my GridView code:
I am having an issue with my GridView control. My goal is to group a grid by a column called "Category", but not show that column in the grid. I then want to show sum aggregates for each group on only certain rows (the number rows). Lastly, I want to show custom numbers in the column footer of my grid (a total sum and a margin calculation).
The problem is that my group aggregates are not appearing.
Here is my GridView code:
<
telerik:RadGridView
HeaderRowStyle
=
"{StaticResource GridViewHeaderRowStyle1}"
Name
=
"radGridView1"
ShowGroupPanel
=
"False"
Grid.Row
=
"1"
ShowColumnFooters
=
"True"
AutoExpandGroups
=
"True"
ShowGroupFooters
=
"True"
>
<
telerik:RadGridView.GroupRowStyle
>
<
Style
TargetType
=
"telerik:GridViewGroupRow"
>
<
Setter
Value
=
"False"
Property
=
"ShowHeaderAggregates"
/>
</
Style
>
</
telerik:RadGridView.GroupRowStyle
>
<
telerik:RadGridView.GroupDescriptors
>
<
telerik:GroupDescriptor
Member
=
"Category"
SortDirection
=
"Descending"
>
<
telerik:GroupDescriptor.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"OriginalBudget"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GroupDescriptor.AggregateFunctions
>
</
telerik:GroupDescriptor
>
</
telerik:RadGridView.GroupDescriptors
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding CostType}"
Header
=
"Cost Type"
TextAlignment
=
"Center"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding CostTypeDesc}"
Header
=
"Cost Desc"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding OriginalBudget}"
Header
=
"Orig. Budget"
DataFormatString
=
"{}{0:c}"
TextAlignment
=
"right"
FooterTextAlignment
=
"right"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
UniqueName
=
"origBudget"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"OriginalBudget"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:GridViewDataColumn.Footer
>
<
StackPanel
>
<
TextBlock
Text
=
"Subtotal"
/>
<
TextBlock
Text
=
"Margin"
HorizontalAlignment
=
"Right"
/>
</
StackPanel
>
</
telerik:GridViewDataColumn.Footer
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding CurrentBudget}"
Header
=
"Curr. Budget"
DataFormatString
=
"{}{0:c}"
TextAlignment
=
"right"
FooterTextAlignment
=
"right"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
UniqueName
=
"currBudget"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"CurrentBudget"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:GridViewDataColumn.Footer
>
<
StackPanel
>
<
TextBlock
Text
=
"Subtotal"
/>
<
TextBlock
Text
=
"Margin"
HorizontalAlignment
=
"Right"
/>
</
StackPanel
>
</
telerik:GridViewDataColumn.Footer
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding PreviousPeriodActual}"
Header
=
"Actual - Previous"
DataFormatString
=
"{}{0:c}"
TextAlignment
=
"right"
FooterTextAlignment
=
"right"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
UniqueName
=
"prevActual"
Width
=
"100"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"PreviousPeriodActual"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:GridViewDataColumn.Footer
>
<
StackPanel
>
<
TextBlock
Text
=
"Subtotal"
/>
<
TextBlock
Text
=
"Margin"
HorizontalAlignment
=
"Right"
/>
</
StackPanel
>
</
telerik:GridViewDataColumn.Footer
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding CurrentPeriodActual}"
Header
=
"Actual - Current"
DataFormatString
=
"{}{0:c}"
TextAlignment
=
"right"
FooterTextAlignment
=
"right"
UniqueName
=
"curActual"
Width
=
"100"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"CurrentPeriodActual"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:GridViewDataColumn.Footer
>
<
StackPanel
>
<
TextBlock
Text
=
"Subtotal"
/>
<
TextBlock
Text
=
"Margin"
HorizontalAlignment
=
"Right"
/>
</
StackPanel
>
</
telerik:GridViewDataColumn.Footer
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding DTCAmount}"
Header
=
"DTC Amount"
DataFormatString
=
"{}{0:c}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"DTCAmount"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding PeriodCosts}"
Header
=
"Period Costs"
DataFormatString
=
"{}{0:c}"
TextAlignment
=
"right"
FooterTextAlignment
=
"right"
HeaderCellStyle
=
"{StaticResource CustomGridHeaderStyle}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
SourceField
=
"PeriodCosts"
ResultFormatString
=
"{}{0:c}"
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
I should mention that the data source for this GridView is a collection of POCOs