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 and modify the selected record in the WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: July 29, 2015 |
Last Revised Date: December 31, 2019

Change the selected records in grid

In order to get the selected records from the 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 records

Samples:

C#: Selected_Records_CS

VB: Selected_Records_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