[Sv] - remove filter-row?

Hi,
My source data is datatable with a column checkbox, I have filtered the choices True.
If I want to delete all rows that display after the filter with above condition, how do I delete some specific row at index or all rows?

5 Replies

VS Vijayarasan Sivanandham Syncfusion Team May 6, 2020 01:18 PM UTC

Hi Khanh Dang,

Thank you for contacting Syncfusion support.

In the SfDataGrid, you can delete the selected row by pressing the Delete key when theSfDataGrid.AllowDeleting is set to true. Please refer the below user documentation for more details,

UG Link:
https://help.syncfusion.com/windowsforms/datagrid/datamanipulation#delete-row 
In another way the selected records can be deleted by using the DeleteSelectedRecords method in SfDataGrid. Please refer the below code snippet, 
btnSelectedRow.Click += BtnSelectedRow_Click;        
 
private void BtnSelectedRow_Click(object sender, EventArgs e) 
{ 
           this.sfDataGrid1.DeleteSelectedRecords(); 
} 

In another case remove the row by condition base in datatable collection in SfDataGrid. Please refer the below code snippet,
 
private void BtnDelete_Click(object sender, EventArgs e) 
{ 
     var removeRows = employeeCollection.AsEnumerable().Where(r => (bool)r["IsShipped"] == true).ToList(); 
 
      foreach (var row in removeRows) 
      { 
                employeeCollection.Rows.Remove(row); 
      } 
} 
 
Regards,
Vijayarasan S
 



TG The GridLock May 6, 2020 04:31 PM UTC

Hi Vijayarasan,
I will try them again..


VS Vijayarasan Sivanandham Syncfusion Team May 7, 2020 07:35 AM UTC

Hi Khanh Dang

Thanks for the update.
 
 
We will wait to hear from you. 
 
Regards, 
Vijayarasan S 



TG The GridLock May 7, 2020 02:08 PM UTC

Hi Vijayarasan,
Exciting. Thanks for the sample file! It makes sense to me.


VS Vijayarasan Sivanandham Syncfusion Team May 8, 2020 05:44 AM UTC

Hi Khanh Dang,

We are glad to know that the reported issue has been resolved. Please get back to us if you have any other queries. As always, we will happy to assist you
😊

Regards,
Vijayarasan S



Loader.
Up arrow icon