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

Adding multiple totals/summary items to Gridview

2 Answers 379 Views
GridView
This is a migrated thread and some comments may be shown as answers.
evan
Top achievements
Rank 1
evan asked on 11 Nov 2019, 09:28 PM

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 Answers, 1 is accepted

Sort by
0
evan
Top achievements
Rank 1
answered on 12 Nov 2019, 01:20 PM
Hi- Please disregard- I found Telerik.WinControls.Data.GroupDescriptor and this has solved my problem.  Thanks
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Nov 2019, 02:08 PM
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.
Tags
GridView
Asked by
evan
Top achievements
Rank 1
Answers by
evan
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or