We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show the summary value of a summary row in caption row in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: summaries


In order to show the summary value in group caption, customize the caption text format with name of GridSummaryRowDescriptor and name of GridSummaryColumnDescriptor.


//To add summary.
GridSummaryColumnDescriptor summaryColumnDescriptor = new GridSummaryColumnDescriptor();
summaryColumnDescriptor.Name = "Category";
summaryColumnDescriptor.DataMember = "CategoryID";
summaryColumnDescriptor.Format = "{Average:#.00}";
summaryColumnDescriptor.SummaryType = SummaryType.DoubleAggregate;        
GridSummaryRowDescriptor summaryRowDescriptor = new GridSummaryRowDescriptor();
summaryRowDescriptor.Name = "Average of CategoryID column";           
this.gridGroupingControl1.TopLevelGroupOptions.ShowSummaries = false;
//To retrieve summaryrow name.
string summaryRowName = summaryRowDescriptor.Name;
//To retrieve summarycolumn name.
string summaryColumnName = summaryColumnDescriptor.Name;
//Setting caption text. 
this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{Category} {RecordCount} Items at Average {" + summaryRowName + "." + summaryColumnName + "}" ;



'To add summary.
Dim summaryColumnDesecriptor As New GridSummaryColumnDescriptor()
summaryColumnDesecriptor.Name = "Category"
summaryColumnDesecriptor.DataMember = "CategoryID"
summaryColumnDesecriptor.Format = "{Average:#.00}"
summaryColumnDesecriptor.SummaryType = SummaryType.DoubleAggregate
Dim summaryRowDescriptor As New GridSummaryRowDescriptor()
summaryRowDescriptor .Name = "Summary Row"
summaryRowDescriptor .SummaryColumns.Add(summaryColumnDescriptor)
Me.gridGroupingControl1.TopLevelGroupOptions.ShowSummaries = False
'To retrieve summaryrow name.
Dim summaryRowName As String = summaryRowDescriptor.Name
'To retrieve summarycolumn name.
Dim summaryColumnName As String = summaryColumnDescriptor.Name
'Setting caption text. 
Me.gridGroupingControl1.ChildGroupOptions.CaptionText = "{Category} {RecordCount} Items at Average {" & summaryRowName & "." & summaryColumnName & "}"



 Setting summary value in caption text



C#: Retrieving SummaryValue_CS

VB: Retrieving SummaryValue_VB

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/summaries

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile