)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the summary values of GridSummaryRow in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: May 15, 2018 |
Last Revised Date: December 23, 2019
Tags: summaries

Summaries

In order to get the summary values of a summary row, GridEngine.GetSummaryText() method can be used.

C#

 //Event Subscription
this.gridGroupingControl1.SourceListListChangedCompleted += GridGroupingControl1_SourceListListChangedCompleted;
//Event Customization
private void GridGroupingControl1_SourceListListChangedCompleted(object sender, TableListChangedEventArgs e)
{
    int row = this.gridGroupingControl1.TableModel.RowCount;
    var rec = this.gridGroupingControl1.Table.DisplayElements[row];
    GridSummaryRow sr = rec as GridSummaryRow;
    if (sr != null)
    {
        foreach (GridSummaryColumnDescriptor scd in sr.SummaryRowDescriptor.SummaryColumns)
        {
            string result = GridEngine.GetSummaryText(sr.ParentGroup, scd);
            this.textBox1.Text = result;
        }
    }
}         

 

VB

'Event Subscription
AddHandler Me.gridGroupingControl1.SourceListListChangedCompleted, AddressOf GridGroupingControl1_SourceListListChangedCompleted
'Event Customization
Private Sub GridGroupingControl1_SourceListListChangedCompleted(ByVal sender As Object, ByVal e As TableListChangedEventArgs)
    Dim row As Integer = Me.gridGroupingControl1.TableModel.RowCount
    Dim rec = Me.gridGroupingControl1.Table.DisplayElements(row)
    Dim sr As GridSummaryRow = TryCast(rec, GridSummaryRow)
    If sr IsNot Nothing Then
       For Each scd As GridSummaryColumnDescriptor In sr.SummaryRowDescriptor.SummaryColumns
 Dim result As String = GridEngine.GetSummaryText(sr.ParentGroup, scd)
 Me.textBox1.Text = result
       Next scd
    End If
End Sub

 

Screenshot

Get the summary values of grid summary row

 

Samples:

C#: Get summary values_CS

VB: Get summary values_VB

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon