Reputation: 8630
I need to filter a data bound DataGridView when a CheckBox is checked/unchecked.
The filter is based on Completed/Uncompleted Records.
When I load the data into the underlying DataTable, I select all records from the Table.
When the application runs I want it to start up with only uncompleted records present.
When the user checks the check box it switches to completed tasks.
I have been able to do this with using DataView.RowFilter(), but the problem is that when ever a user marks an item as completed within the grid, it automatically removes it from view. (where the CheckBox is unchecked).
I only want the Data to filter as and when the CheckBox is checked/unchecked.
The one thing that I want to stay away from is re-loading the data from the database each time the CheckBox.checked event is fired, with a specific SQL statement.
I want to filter the Data in memory, but only as and when The user interacts with the CheckBox.
Any Suggestions welcome.
Upvotes: 1
Views: 1068
Reputation: 73313
You could use DataTable.Select
to filter the data instead of DataView.RowFilter
and only update the Select filter when the checkbox check status changes.
Upvotes: 2