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

Get Selected Rows

How can I get column information for each row the user selects?  For example, if one of my columns is RecordID, how can I get a list of all the RecordIDs of the rows the user has selected?

3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team March 14, 2019 10:31 AM UTC

Hi Derek, 

Thanks for using Syncfusion product. 

You can able to get the selected records from the SfDataGrid.SelectedItems property. Please refer the below code snippet to achieve your requirement, 

List<object> items = new List<object>();            

foreach (object item in this.sfDataGrid1.SelectedItems
    var value = this.sfDataGrid1.View.GetPropertyAccessProvider().GetValue(item, "OrderID"); 
    items.Add(value); 




 

If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 

Regards, 
Jagadeesan 



DG Derek Geldart March 14, 2019 07:42 PM UTC

This works perfect!


JP Jagadeesan Pichaimuthu Syncfusion Team March 15, 2019 05:01 AM UTC

Hi Derek, 

Thanks for the update. 

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 

Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon