I have a data grid that is bound to a hierarchical object. Both the top level and the child level objects have checkboxes. I want them to behave like a typical tree view, wherein the parent checkbox is a tri-state and if the user clears or sets it the child objects are checked/uncheked appropriately.
I curently have the UpdateMode set to OnCellChange but I need the change to be propogated to my child objects immediately after the checkbox is clicked rather than after the user moves off of the cell. Is there another property or maybe an event that fires when the checkbox is changed so that I can manually call update?
What you can do is handle the grid's CellChange event and call grid.ActiveRow.Update. This will commit all changed to the current row to the grid's DataSource. It's probably a good idea to only do this for CheckBox cells, though, as it could cause an error for other types because CellChange fires for every keystroke.
For example, if you have a date field, the user could type a single character, which is not a valid date, and you would not want to update in that case. It's safe for a CheckBox cell, though, since the user cannot enter a partial value - it's either checked or unchecked.
Exactly what I was looking for, thanks.