Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
Changed data isn't available in CellChange event?
posted

I have a grid with a boolean column that's bound to a collection of business objects living in a BindingSource object.  This boolean column represents a field where only one of the business objects in the collection can have it set (its called "primary", and only one of them can be primary).  I'm trying to put code in the CellChange event to watch what the user is clicking on, and if they're clicking on this column I'm going to do some validation (if they mark it true, I make sure to uncheck the previous object marked primary.  If they mark it false, I let the user know that ONE object has to be primary).

The problem I'm running into is that in the CellChange event, the cell value is ALWAYS what it was when I originally bound the grid to the data.  As the user clicks on the checkbox repeatedly I'm writing to the console, and the value never changes.  Furthermore, when check the value of the bound field by saying e.Cell.Row.ListObject, that value never changes either.  But when I unload the form and save all my data, the value is copied correctly.

Should I not be using CellChange for this??

Parents Reply Children