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

[Solved] Subtotals on gridview

6 Answers 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jackie
Top achievements
Rank 1
Jackie asked on 22 Jul 2011, 03:52 PM
I populate the radgrid dynamically using C#. Is there a way to use the subtotals/totals when the columns are not bound in the xaml. All the examples and forums show columns being bound in the xaml.

6 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 22 Jul 2011, 05:33 PM
Hi Jacqueline,

 

There is no problem to refer aggregates in code behind. There are various ways to refer an aggregate function in code-behind for a particular column:


CountFunction f = new CountFunction();
( ( GridViewDataColumn )this.radGridView.Columns[ "ID" ] ).AggregateFunctions.Add( f );

 
You may do the same for grouping aggregates. Please refer to our online docs for further info. 


Greetings,
Vanya Pavlova
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jackie
Top achievements
Rank 1
answered on 22 Jul 2011, 07:57 PM
That code works when working with the count function. When I try to use the SumFunction:

SumFunction s = new SumFunction();

s.Caption =

"Sum: ";

((

GridViewDataColumn)this.rgvResults.Columns["Weight"]).AggregateFunctions.Add(s);


I get the attached error. I am using Silverlight 3, Visual Studio 2008 on a Windows 7 64bit.

Thank you
0
Vanya Pavlova
Telerik team
answered on 22 Jul 2011, 09:20 PM
Hi Jacqueline,

 

Generally you may perform sum operation only to numeric types. What is the data type of the property to which this column is bound to? Regarding the version you are currently using I would want to inform you that Telerik support for Silverlight 3 has been obsoleted. Would it be convenient to you to upgrade to the latest version of RadControls/Silverlight?

 

Best wishes,
Vanya Pavlova
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jackie
Top achievements
Rank 1
answered on 25 Jul 2011, 02:12 PM
All the fields that I am trying to sum are decimal fields or interger fields. I will check into upgrading to the newest version.
0
Jackie
Top achievements
Rank 1
answered on 28 Jul 2011, 02:26 PM
Upgrading is currently not an option due to the fact that it requires Visual Studio 2010, which would mean we would also need to upgrade Blend, Silverlight, Telerik Controls.

I continued to try different things, even by switching all the fields to numeric it still throws the same error.

Thanks
0
Jackie
Top achievements
Rank 1
answered on 08 Aug 2011, 08:18 PM
Any word on this yet? It is still error when I use any fuction but Count.
Thanks,
Jackie
Tags
GridView
Asked by
Jackie
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Jackie
Top achievements
Rank 1
Share this question
or