How to get the data object list in sfDatagrid?

How to get the data object list in sfDatagrid?


for example, I am using List<Person> and use ICollectionView to feed sfDatagrid,

it's working fine, but how can I get the current sfdatagrid of Person data?

try to get with SP_DataTable.View.Records, but don't know how to deal with RecordEntry.

My goal is to get a list of <Person> that current sfdatagrid contain.

thanks


            ICollectionView itemsView = CollectionViewSource.GetDefaultView(I_SP_datatable);
            SP_DataTable.ItemsSource=itemsView;

1 Reply 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team December 10, 2021 12:51 PM UTC

Hi Johnes, 

You can get the data objects in the collection bound to the data grid by iterating the SfDataGrid.View.Records as shown in the following code example.  

Code example :  

foreach(var record in this.dataGrid.View.Records) 
{ 
    var data = record.Data; 
} 

RecordEntry.Data property will return the actual data object of the corresponding record. Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Marked as answer
Loader.
Up arrow icon