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

SumFunction not working

2 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 24 Dec 2009, 01:10 AM
I'm trying to use the RadGridView AggregateFunctions. I've tested Count, Min and Max functions successfully. However, when I try using SumFunction or AverageFunction, nothing is displayed on the column footer (including the previously added Count, Min, Max functions).

I'm binding a DataTable to the grid from C# like this:

this.radGrid1.ItemsSource = dtData; 

This is the XAML for the GridView:

<telerikGrid:RadGridView  
            x:Name="radGrid1" 
            MultipleSelect="True"  
            AutoGenerateColumns="False" 
            ShowColumnFooters="True" ShowGroupFooters="True"
 
            <telerikGrid:RadGridView.Columns> 
                 
                <telerikGrid:GridViewDataColumn Header="AccountNo" DataMemberBinding="{Binding AccountNo}"
                    <telerikGrid:GridViewDataColumn.AggregateFunctions> 
                        <telerikData:CountFunction Caption="Count:" /> 
                    </telerikGrid:GridViewDataColumn.AggregateFunctions> 
                </telerikGrid:GridViewDataColumn> 
                 
                <telerikGrid:GridViewDataColumn Header="InvestmentCost" DataMemberBinding="{Binding InvestmentCost}" DataFormatString="{}{0:c}" TextAlignment="Right"
                    <telerikGrid:GridViewDataColumn.AggregateFunctions> 
                        <telerikData:SumFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                        <telerikData:MinFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                        <telerikData:MaxFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> 
                    </telerikGrid:GridViewDataColumn.AggregateFunctions> 
                </telerikGrid:GridViewDataColumn> 
                 
            </telerikGrid:RadGridView.Columns> 
        </telerikGrid:RadGridView> 

Edit: 
DataType for InvestmentCost column in dtData is Decimal.
I'm using RadControls for WPF Q3 2009 SP1

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 28 Dec 2009, 03:33 PM
Hello Jeffrey Lewis,

I have tried to reproduce the problem here but with my test project it seems to work ok .
Please find the test project attached .  Maybe I am missing something to be able to  reproduce the problem ?

Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jeffrey
Top achievements
Rank 1
answered on 30 Dec 2009, 04:03 AM
Thanks, got it to work following your example. The problem was I didn't put this in my SumFunction.

SourceFieldType="{x:Type s:Decimal}"


Tags
GridView
Asked by
Jeffrey
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Jeffrey
Top achievements
Rank 1
Share this question
or