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 access the nested tables in the WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: February 13, 2020

Access the nested tables

You can get access to a nested table inside a record using the following code example. In the following code example, you can get the specific record, or you can get all the records through the Records collection of the nested table.

C#

private void button1_Click(object sender, EventArgs e)
{
   //You can get access to a nested table inside a record whereas n is the specific record that owns the nested table.
   NestedTable nt = this.gridGroupingControl1.Table.Records[3].NestedTables[0];
   ChildTable ct = nt.ChildTable;
   //To get access to a specific record in that child table
   Record recordInNestedTable = ct.Records[3];
   //To get access to all records in that child table
   foreach (Record rec in ct.Records)
   {
      // this.richTextBox1.Text += rec.ToString();
      //[or]
      this.richTextBox1.Text += rec.GetValue("childID") + "\t" + rec.GetValue("Name").ToString() + "\n";
   }
}

VB

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
   'You can get access to a nested table inside a record whereas n is the specific record that owns the nested table.
   Dim nt As NestedTable = Me.gridGroupingControl1.Table.Records(3).NestedTables(0)
   Dim ct As ChildTable = nt.ChildTable
   'To get access to a specific record in that child table
   Dim recordInNestedTable As Record = ct.Records(3)
   'To get access to all records in that child table
   For Each rec As Record In ct.Records
      ' this.richTextBox1.Text += rec.ToString();
      '[or]
      Me.richTextBox1.Text += rec.GetValue("childID") + Constants.vbTab + rec.GetValue("Name").ToString() & Constants.vbLf
   Next rec
End Sub

The access to the third record in the child table is displayed as follows.

Access the nested tables in GridGroupingControl

Samples:

C#: Access_NestedTables

VB: Access_NestedTables

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