)
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 retrieve all records of grouped column when double clicking on it in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: May 18, 2016 |
Last Revised Date: February 12, 2020
Tags: grouping, records

 

 

Records of grouped column

To get the records of grouped columns by double-clicking in GGC, the event gridGroupingControl1_TableControlCellDoubleClick can be used. Using GridTableCellStyleInfo the table records details can be fetched.

This is done by the double click event, which gets the rowIndex and columnIndex of the records of the grouped columns using GridTableControlCellClickEventArgs and can be displayed via a MessageBox dialog.

C#

//Form()
this.gridGroupingControl1.TableControlCellDoubleClick += gridGroupingControl1_TableControlCellDoubleClick;
void gridGroupingControl1_TableControlCellDoubleClick(object sender, GridTableControlCellClickEventArgs e)
{
   GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
   Element el = style.TableCellIdentity.DisplayElement;
   if (el != null)
   {
      string s = "";
      foreach (Record rec in el.ParentGroup.Records)
      {
         //Retrieves the Records of the parent group 
         s += rec.ToString() + Environment.NewLine;
      }
      //Shows the Content in the MessageBox
      MessageBox.Show(s,"Info");
   }
}

VB

'Form()
Me.gridGroupingControl1.TableControlCellDoubleClick += gridGroupingControl1_TableControlCellDoubleClick
Private Sub gridGroupingControl1_TableControlCellDoubleClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
   Dim style As GridTableCellStyleInfo = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex)
   Dim el As Element = style.TableCellIdentity.DisplayElement
   If el IsNot Nothing Then
    Dim s As String = ""
    For Each rec As Record In el.ParentGroup.Records
     'Retrieves the Records of the parent group 
      s &= rec.ToString() & Environment.NewLine
      Next rec
      'Shows the Content in the MessageBox
    MessageBox.Show(s,"Info")
 End If
End Sub

 

Retrieve the records of grouped columns

 

Show the information of records of grouped column

Samples:

C#: ChildGroup_CS

VB: ChildGroup_VB

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