Adding multiple totals/summary items to Gridview

3 posts, 0 answers
  1. evan
    evan avatar
    7 posts
    Member since:
    Jun 2019

    Posted 11 Nov 2019 Link to this post

    Hi- 

    We're trying to add multiple summary rows to a gridview, similar to the single ones being added here:

    https://docs.telerik.com/devtools/winforms/controls/gridview/rows/summary-rows

    Using that example, I added one total, but can't figure out how to add the others that I need:  The example code below just shows a total for TotalTax, but not the others.   Can you point me to any documentation that shows how to do this?   Thanks, Evan

                Me.RGV_RIA_Input_Summary.MasterTemplate.ShowTotals = True

                Dim summaryItem As New GridViewSummaryItem()
                Dim summaryItemState As New GridViewSummaryItem("State", "{0}", GridAggregateFunction.Last)
                Dim summaryItemTotalTax As New GridViewSummaryItem("TotalTax", "Total Tax = {0}", GridAggregateFunction.Sum)
                Dim summaryItemGrossSales As New GridViewSummaryItem("GrossSales", "Total Gross Sales = {0}", GridAggregateFunction.Sum)
                Dim summaryItemExemptionAmount As New GridViewSummaryItem("ExemptionAmount", "Total Exempt = {0}", GridAggregateFunction.Sum)
                Dim summaryItemTotalTaxableSales As New GridViewSummaryItem("TotalTaxableSales", "Total Taxable = {0}", GridAggregateFunction.Sum)
                Dim summaryRowItem2 As New GridViewSummaryRowItem(New GridViewSummaryItem() {summaryItemState, summaryItemTotalTax, summaryItemGrossSales, summaryItemExemptionAmount, summaryItemTotalTaxableSales})
                Me.RGV_RIA_Input_Summary.SummaryRowsTop.Add(summaryRowItem2)

     

     

  2. evan
    evan avatar
    7 posts
    Member since:
    Jun 2019

    Posted 12 Nov 2019 in reply to evan Link to this post

    Hi- Please disregard- I found Telerik.WinControls.Data.GroupDescriptor and this has solved my problem.  Thanks
  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3958 posts

    Posted 12 Nov 2019 Link to this post

    Hello, Evan,    

    I am glad that you have found a suitable solution for your scenario. 

    However, have in mind that there is a difference between summary rows and group rows. The GridViewSummaryRowItem represents a summary row to which you can add many GridViewSummaryItem associated with different columns. Each summary item is intended to calculate a value. On the other hand, the grouping behavior allows you to organize the rows in groups considering the value of a certain column. You can specify different aggregates for the group descriptors and customize the text displayed in the group rows. The following help articles are quite useful on this topic:
    https://docs.telerik.com/devtools/winforms/controls/gridview/grouping/group-aggregates 
    https://docs.telerik.com/devtools/winforms/controls/gridview/grouping/formatting-group-header-row 

    Feel free to use this approach which suits your requirements best.  

    I hope this information helps. If you need any further assistance please don't hesitate to contact me.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top