Articles in this section
Category / Section

How to retrieve and modify record in WinForms GridGroupingControl?

3 mins read

Change the selected records in grid

In order to get the selected records from the WinForms GridGroupingControl, the SelectedRecords property can be used. The SelectedRecords property holds all the selected records in the GridGroupingControl.

 

Retrieving the selected records

The particular record can be retrieved by using the Record property of the SelectedRecords.

C#

private void getSelectedRowBtn_Click(object sender, EventArgs e)
{
   foreach (SelectedRecord selectedRecord in   this.gridGroupingControl1.Table.SelectedRecords)
   {
       MessageBox.Show(selectedRecord.Record.Info);
   }
}

 

VB

Private Sub getSelectedRowBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles getSelectedRowBtn.Click
     For Each selectedRecord As SelectedRecord In Me.gridGroupingControl1.Table.SelectedRecords
         MessageBox.Show(selectedRecord.Record.Info)
     Next selectedRecord
End Sub

 

Modifying the selected records

The record can be modified by using the SetValue method of a particular record based on the columns.

C#

private void modifySelectedRowBtn_Click(object sender, EventArgs e)
{
    foreach (SelectedRecord selectedRecord in this.gridGroupingControl1.Table.SelectedRecords)
    {
        foreach (GridColumnDescriptor column in this.gridGroupingControl1.TableDescriptor.Columns)
        {
            selectedRecord.Record.SetValue(column.Name, "Modified_Record");
        }
    }
}

 

VB

Private Sub modifySelectedRowBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles modifySelectedRowBtn.Click
     For Each selectedRecord As SelectedRecord In Me.gridGroupingControl1.Table.SelectedRecords
 For Each column As GridColumnDescriptor In Me.gridGroupingControl1.TableDescriptor.Columns
      selectedRecord.Record.SetValue(column.Name, "Modified_Record")
  Next column
     Next selectedRecord
End Sub

 

Retrieving the selected records in grid

        Figure 1: Retrieving the selected records

Modifying the selected records in grid

Figure 2: Modifying the selected record in grid.

Conclusion

I hope you enjoyed learning about how to retrieve and modify record in WinForms GridGroupingControl.

You can refer to our  WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-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