I am using a checkbox in one of my columns. the user could check any number of rows (or uncheck them). What would be the best way to know if any cells in this column have changed data?
Hi Duane,
The grid doesn't keep track of whether any item in the column is checked. So you will need to do that in your code. It sounds to me like you just want to keep a dirty flag if there are any pending changes that need to be saved.
If you are using a DataTable (or DataSet) as your grid's DataSource, then the DataTable itself has methods to tell you if there are any pending changes that need to be saved to the back end.
Or, you could use CellChange to detect when a change is made and set a flag.
Matt,
thanks for the info.
I am aware of those events. But in this particular form the user will be filtering invoiced data, checking/unchecking some invoices, choosing a different filter and checking/unchecking some more invoices. The user is filtering invoices for many different salesmen and I need them to know if they have checked/unchecked ANY invoice. They may be interupted at any point and forget what they have done for a previous filter. I want to activate a button on the toolbar if there are any checkboxes that have been changed from its original value. That way, they will know that they have invoices that have been changed.
-duane
If you need to take immediate action, your best bet is to use the CellChange event and look at the cell.EditorResolved.Value (as outlined in this thread). If you want to wait until later, you could look at the AfterCellUpdate or AfterRowUpdate events.
-Matt