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

Summaries for each group in RadGridView

1 Answer 652 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Bryan asked on 11 Feb 2020, 05:32 AM

It seems that I cannot display the exact sum of each group in the radGridView.

I want is to add the sum of the Column A group and the sum of the Column B group belonging to group A,

respectively, and the total at the bottom.

If I want to implement what I want C#, I want to know how to implement it.

I want you to show me how useful RadGridView is.

Please refer to my attached file.


1 Answer, 1 is accepted

Sort by
Nadya | Tech Support Engineer
Telerik team
answered on 13 Feb 2020, 12:32 PM

Hello Bryan,

If you have summary rows in a grouped RadGridView you can use the following properties in order to display the sum of total groups as well as the sum of each group:

  • ShowTotals - Indicate whether total summary rows are visible in a grouping.
  • ShowSubTotals - indicates whether summary rows will be shown for each group.
  • ShowParentGroupSummaries - Indicating whether parent group summary rows are visible in a grouping.

You can find below a sample code snippet which result is demonstrated in the attached picture:

public RadForm1()

    DataTable dt = new DataTable();
    dt.Columns.Add("Name", typeof(string));
    dt.Columns.Add("Color", typeof(Color));
    dt.Columns.Add("Value", typeof(decimal));

    dt.Rows.Add("AA", Color.Red, 2);
    dt.Rows.Add("AA", Color.Red, 5);
    dt.Rows.Add("AA", Color.Red, 3);
    dt.Rows.Add("AA", Color.Green, 4);
    dt.Rows.Add("AA", Color.Green, 6);
    dt.Rows.Add("AA", Color.Green, 2);
    dt.Rows.Add("AA", Color.Blue, 7);
    dt.Rows.Add("AA", Color.Blue, 3);
    dt.Rows.Add("BB", Color.Red, 6);
    dt.Rows.Add("BB", Color.Red, 9);
    dt.Rows.Add("BB", Color.Green, 2);
    dt.Rows.Add("BB", Color.Green, 2);
    dt.Rows.Add("BB", Color.Blue, 4);
    dt.Rows.Add("BB", Color.Blue, 3);
    this.radGridView1.DataSource = dt;
    GridViewSummaryItem summaryItem = new GridViewSummaryItem();
    summaryItem.Name = "Value";
    summaryItem.AggregateExpression = "(Sum(Value))";
    GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();

   this.radGridView1.MasterTemplate.ShowTotals = true;
    this.radGridView1.MasterTemplate.ShowSubTotals = true;
    this.radGridView1.MasterTemplate.ShowParentGroupSummaries = true;

I hope this helps. Should you have any other questions do not hesitate to ask.

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.
Asked by
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question