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. Image for the cookie policy date

Howto Get Selected row(s) when using SelectionMode Any

Just an Howto Question,

I Have a SfDataGrid in an application that contains financial data. The users would like to be able to copy the contents of the fields by Cell not by row.
Unfortunately I'm not able to set this type of selection mode because if I set the SelectionMode = Any, I am not able to get the data from the selected row(s)

This is because the SelectedItems of the datagrid are not set when the mode is Any and from the AddedItems in the event handler I'm not able to find the rows selected.

Is There a Way to get a list of the data underneath the selected objects/cells/rows when the selection is set in Any or Cell mode?

The ItemsSource is a DataTable so the SelectedItems are a collection of DataRowView when in Row Mode.

If it would be possible to get the Underneath record from the selected cells it would be easy to get just the distinct objects and build a collection of the selected rows.
But I have no Idea about how to do this.

If you have any clue it would be appreciated.
regards
Sabrina

1 Reply

SV Srinivasan Vasu Syncfusion Team June 1, 2016 09:40 AM UTC

Hi Sabrina, 
 
Thanks for contacting Syncfusion support. 
 
Query 1[Get Selected CellValue ]: 
We have analyzed your query and you have to use SelectionController.SelectedCells property or SfDataGrid.GetSelectedCells method to get the selected cells value.  
 
Please refer the below UG link: 
 
Please refer the below Kb Link: 
 
 
Query 2[ Using EventHandler]: 
When SelectionUnit is Any, you can also get the selected records from SelectionChanged event from AddedItems, which contains the collection of GridCellInfo.  
 
Please refer the below UG link: 
 
 
 
Regards, 
Srinivasan 
 


Loader.
Live Chat Icon For mobile
Up arrow icon