Articles in this section
Category / Section

How to retrieve all records of grouped column when double clicking on it in WinForms GridGroupingControl?

2 mins read

 

 

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

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