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

Sum (agregate function) on selected row in GridView

4 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
skrec
Top achievements
Rank 1
skrec asked on 25 Mar 2011, 11:17 AM
Hello,

I have this little question. I know how to apply sum function on all rows in GridView.

My question is: it is possible to apply sum function only on selected rows in GridView??

Thanks Petr.

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 25 Mar 2011, 12:44 PM
Hi skrec,

If you know the type of your business object, which I am sure you do, you can do something like this by using LINQ and the Enumerable extension methods:

var sumOfSalaries = this.RadGridView.SelectedItems.OfType<FootballPlayer>().Sum(player => player.Salary);

I hope this helps.

Regards,
Ross
the Telerik team
0
skrec
Top achievements
Rank 1
answered on 29 Mar 2011, 01:29 PM
Thaks for answer.
But I thought, if the telerik GridView has build-in abillity to Sum only selected GridView rows (I know how apply Sum function on all displayed rows.

Thanks. Petr
0
Naimish
Top achievements
Rank 1
answered on 05 Feb 2015, 03:52 PM
Hello,
I have this little question. 
it is possible to get GridView aggregate function value store in singal variable .?
0
Dimitrina
Telerik team
answered on 09 Feb 2015, 11:16 AM
Hello Petr,

I am not sure how to understand your question. Would you please clarify it a bit?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
skrec
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
skrec
Top achievements
Rank 1
Naimish
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or