Hi,

I have a datagridview which displays customer orders. I have implemented a search panel with various options to narrow down the subset of orders by applying a string of filters to the bindingsource.

I have also added an unbound checkbox column to allow the user to select/deselect orders along with a Select/Deselect All button.

My problem is this; if i select some orders then chagne the filtering the checkboxes are all cleared. I Obviously i dont want to have orders selected that were removed by the filter, but is there any way to maintain the checked state of the orders that remain in the subset?

I realise i could store the checked orders in a list then loop through the rows re-checking those still visible, but i'm concerned about the computational cost and speed factors in doing this with a large dataset. Anyone know a better way to go about it?

You would have to either bind those "Selection" checkboxes to a field in the datasource or do as you mentioned and re-check the values. If you're binding to a DataTable you should be able to add another column for the "Checked" state. Just exclude that column in your DataAdapter or whatever you use to update the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.