How to read selected row from GridGroupingControl

I set .TableOptions.ListBoxSelectionMode = SelectionMode.One
I just want to navigate (by mouse or keyboard) throughGridGroupingControl records and I need to read a specific cell value of selected row.
How can I do this?
Thanks

5 Replies

AR Arulpriya Ramalingam Syncfusion Team November 28, 2017 09:00 AM UTC

Hi Constantin,   
   
Thanks for contacting Syncfusion support.   
   
As per the grid architecture, the selected rows will be added to SelectedRecords collection when the ListBoxSelectionMode is enabled and the selected rows will be added to SelectedRanges collection when the AllowSelection is enabled. So as per your requirement, the selected records can be retrieved from the Table.SelectedRecords collection and the cell value of selected records can be retrieved by using the GetValue() method of Record. We have created a simple sample as per your requirement. Please make use of below KB and sample,   
   
Code example:   
   
if(this.gridGroupingControl1.Table.SelectedRecords.Count > 0)   
{   
    foreach(SelectedRecord selectedRecord inthis.gridGroupingControl1.Table.SelectedRecords)   
    {   
        //To get the cell value of particular column of selected records   
        string cellValue = selectedRecord.Record.GetValue("Name").ToString();   
        MessageBox.Show(cellValue);   
    }   
}   
   
   
   
Regards,   
Arulpriya  



CB CONSTANTIN BOGDAN December 3, 2017 07:53 PM UTC

No, your answer solved my problem. Thank you.


AR Arulpriya Ramalingam Syncfusion Team December 4, 2017 05:14 AM UTC

Hi Constantin, 
 
Thanks for your update.    
 
We are really happy to hear that the solution resolved your requirement.   
 
Please let us know if you have any other queries.    
   
Regards, 
Arulpriya 



UN Unknown November 16, 2021 05:24 PM UTC

Anyone have a VB sample of how to do this?



AR Arulpriya Ramalingam Syncfusion Team November 17, 2021 08:53 AM UTC

Hi Greg, 
 
Thank you for the update 
 
We have converted the sample to VB and please make use of the below code and sample. 
 
Example code 
 
If Me.gridGroupingControl1.Table.SelectedRecords.Count > 0 Then 
            For Each selectedRecord As SelectedRecord In Me.gridGroupingControl1.Table.SelectedRecords 
                        'To get the cell value of particular column of selected records 
                        Dim cellValue As String = selectedRecord.Record.GetValue("Name").ToString() 
                        MessageBox.Show(cellValue) 
            Next selectedRecord 
End If 
 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Arulpriya Ramalingam 


Loader.
Up arrow icon