Database only getting updated after focus lost from bool column in datagrid

G

Greg

My problem is that values in the bool column of a datagrid are only
being updated to the database once the focus of the bool cell is lost.
This is completely counter-intuitative. When a user clicks on a bool
type cell in a datagrid and sees a check mark put in / removed, then
he/she would expect this to be reflected in the databsae immediately.

I've even overriden the paint, commit and edit methods of the bool
column class (which inherits from DataGridBool column as this appears
to be a common mechanism used to trap the change to the bool value.
This part works - but when the BoolValueChanged method fires, it fails
to update the dataset via the dataAdapter (called explicitly). The
update only completes when the focus is switched to another cell.

The only solution that I can come up with so far is a bit of a kludge -
which is to change the focus within the BoolValueChanged event. Is
there any other way around this???

Any suggestions would be very welcome - I've lost lots of sleep over
this one!

Greg.
 
G

Greg

Thanks Mark.

I assume that you mean EndEdit on the datagrid object.
I did that try that but the updating is still only occurring after the
focus has left a cell.

However, I don't have a call to BeginEdit - most likely I need this,
but where should it be?

Thanks again,

Greg.
 
G

Guest

Greg,

try:

BindingContext[this.yourDataGrid.DataSource,
this.yourDataGrid.DataMember].EndCurrentEdit();

That worked for me.

Hope this helps

McFloyd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top