Articles in this section
Category / Section

How to delete a selected record from child table in WinForms GridGroupingControl?

2 mins read

Delete the record from child table

In order to delete the selected row from the WinForms Grid Control, GetTable method can be used to get the child table and the selected record will be deleted by Record.Delete method for child table. 

C#

private void button1_Click(object sender, EventArgs e)
{
   Syncfusion.Grouping.SelectedRecordsCollection selectedRecordsCollection= null;
   //Used to get the child table
   Table table = this.gridGroupingControl1.GetTable("MyChildTable");
   selectedRecordsCollection= table.SelectedRecords;
   foreach (Syncfusion.Grouping.SelectedRecord selectedRecord in selectedRecordsCollection)
   {
      //Used to delete the selected records.
      selectedRecord.Record.Delete();
   }
}

VB

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
   Dim selectedRecordsCollection As Syncfusion.Grouping.SelectedRecordsCollection = Nothing
   'Used to get the child table
   Dim table As Table = Me.gridGroupingControl1.GetTable("MyChildTable")
   selectedRecordsCollection = table.SelectedRecords
   For Each selectedRecord As Syncfusion.Grouping.SelectedRecord In selectedRecordsCollection
      'Used to delete the selected records.
      selectedRecord.Record.Delete()
   Next record 
End Sub

Screenshot

Before Deletion

Before delete the record from child table in WinForms Grid Control

After Deletion

After delete the record from child table in WinForms Grid Control

 

Samples:

C#: Deleting_Record_CS

VB: Deleting_Record_VB

Conclusion

I hope you enjoyed learning about how to delete a selected record from child table in WinForms GridGroupingControl.

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

For current customers, you can check out our WinForms 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 Grid Control 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 forums, Direct-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