Sum (agregate function) on selected row in GridView

5 posts, 0 answers
  1. skrec
    skrec avatar
    10 posts
    Member since:
    Mar 2011

    Posted 25 Mar 2011 Link to this post

    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.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 25 Mar 2011 Link to this post

    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
  3. skrec
    skrec avatar
    10 posts
    Member since:
    Mar 2011

    Posted 29 Mar 2011 Link to this post

    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
  4. Naimish
    Naimish avatar
    1 posts
    Member since:
    May 2014

    Posted 05 Feb 2015 Link to this post

    Hello,
    I have this little question. 
    it is possible to get GridView aggregate function value store in singal variable .?
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 09 Feb 2015 Link to this post

    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.

     
Back to Top