Articles in this section
Category / Section

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

2 mins read

Summaries

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

C#

//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";           
summaryRowDescriptor.SummaryColumns.Add(summaryColumnDescriptor);
gridGroupingControl1.TableDescriptor.SummaryRows.Add(summaryRowDescriptor);            
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 + "}" ;

 

VB

'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)
gridGroupingControl1.TableDescriptor.SummaryRows.Add(summaryRowDescriptor)
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 & "}"

 

Screenshot

 Setting summary value in caption text in WinForms GridGroupingControl

 

Samples:

C#: Retrieving SummaryValue_CS

VB: Retrieving SummaryValue_VB

Reference link: https://help.syncfusion.com/windowsforms/gridgrouping/summaries

​Conclusion

I hope you enjoyed learning about how to show the summary value of a summary row in caption row in WinForms GridGroupingControl.

You can refer to our  WinForms GridGroupingControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our   WinForms GridGroupingControl documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridGroupingControl and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied