I have a DataGridView control that is bound to a custom typed list (that inherits BindingList). I would like to be able to filter rows based on a simple column value (bool type). Ultimately, the fonctional goal is to be able to mark an item as deleted but just flag it as deleted in the DataSource, not remove it. Juste remove it from the grid, not the DataSource.
Any idea ?
You can use LINQ to filter your data then create a new BindingList and reassign it to the dataGridView.
Assuming you have a flag in the person class called WillBeDeleted:
dataGridView1.DataSource = new SortableBindingList<Person>
(SampleData.Where(p => !p.WillBeDeleted).ToList());
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With