DataGridView, BindingList<T>, EndEdit() problem - 06-27-2008 , 10:09 AM
Related to DGV bound to a DataBindingSource whose DataSource is
BindingList<T> derivative where T implements IEditableObject.
By default, when one loads a DGV, BeginEdit() is called on the underlying
object in the first row. That's expected. When the user clicks into another
row, the first row's EndEdit() is called and BeginEdit() is called on the new
row's object. Also expected.
Now, let's say, the user is parked on the grid's fourth row (whose
BeginEdit() has been called) and the user decides to sort the grid by
clicking a column header. After the sort is done, the fourth row of the grid
is still highlighted, but because the order changed, the underlying object is
no longer the original one, it's some other object. The new object's
BeginEdit() has been called, which is expected and OK. The problem is that
the EndEdit() of the object that used to be under row four is never called,
which is unexpected and not OK.
Is this a known issue?
Other than calling EndEdit() in response to one of the grid's events (in
this case the column header's), is there any other solution?
|Thread Tools||Search this Thread|