sfdatagrid filtering to return only visible values

          
below code is what I used to get the ids from datagrid and store to string.
however, if I filter the datagrid using this code.still giving me all the ids. how can I modified this code to return only what is visible in datagrid during filtering.
  
DataTable dtable = (DataTable)this.dataGridView1.DataSource;
      
            Dv = new DataView(dtable);
            foreach (DataRowView drv in Dv)
            {
                s.Add(drv["Ids"].ToString());
            }
          

1 Reply 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team July 30, 2020 12:29 PM UTC

Hi Mark, 

Thanks for contacting Syncfusion support. 

You can achieve this by iterating the records from the SfDataGrid.View.Records collection as shown in the following code example. 

Code example :  

List<string> collection = new List<string>(); 
 
foreach (RecordEntry record in this.dataGrid.View.Records) 
{ 
    collection.Add((record.Data as DataRowView).Row["ID"].ToString()); 
} 



Please let us know if you require further assistance from us. 

Regards, 
Mohanram A. 


Marked as answer
Loader.
Up arrow icon