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

SumFunction doesn't recalculate values

3 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CHRISTIAN
Top achievements
Rank 1
CHRISTIAN asked on 16 Nov 2011, 11:08 AM
Hi Telerik-team,
I use the SumFunction on a few of columns in my RadGridView.
When I change programmatically values in my grid the sums are not updated.
They are updated though when I insert a new row.
What do I have to do to have the sums recalculated on every change in the grid?

Here is sample code of my column
<t:GridViewDataColumn UniqueName="SumBrutto" TextAlignment="Right" FooterTextAlignment="Right" DataMemberBinding="{Binding SumBrutto, Mode=TwoWay}" Header="SampleHeader">
                    <t:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction />
                    </t:GridViewDataColumn.AggregateFunctions>
                </t:GridViewDataColumn>

Regards,

Christian

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 17 Nov 2011, 03:44 PM
Hi Christian,

If you want to force the rebind when a value have been changed in code behind, then you should inform the GridView that the collection has changed. You may do this like so:

myGridView.Items.EditItem(itemToEdit);
// change the value
myGridView.Items.CommitEdit();
That way the sums will be recalculated on every change in the grid.


Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
CHRISTIAN
Top achievements
Rank 1
answered on 18 Nov 2011, 02:18 PM

thank you for your help but is there a solution to this problem using MVVM?
I would like to Call CommitEdit on the GridView from VM rather the CodeBehind.

Regards,

Christian
0
Pavel Pavlov
Telerik team
answered on 18 Nov 2011, 03:22 PM
Hello Christian,

The only alternative we can offer is at the place where you  programatically update the values to include a call to the CalculateAggregates() method of RadGridView.


All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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