473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

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.

Feb 27 '06 #1
3 2246
Hi Greg,
did you try calling the EndEdit method to commit the changes?

Mark
http://www.markdawson.org
"Greg" wrote:
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.

Feb 27 '06 #2
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.

Feb 27 '06 #3
Greg,

try:

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

That worked for me.

Hope this helps

McFloyd

"Greg" wrote:
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.

Mar 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
0
by: raj | last post by:
Hi, The focus in the datagrid is not lost even after leaving the datagrid. The selected cell is highlighted even when the focus from the datagrid is lost. This happens only after the .NET...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
0
by: Carlos Lozano | last post by:
Hello everybody, I Have a piece of code for a Pocket PC that has a disabled and hidden textbox control at startup. It is enabled and set visible programatically. The cursor is captured calling...
1
by: J.H.. | last post by:
With who way I can remove the focus from a DataGrid Control using the key Tab in a WinForm in C# ? The key Tab transports the focus in the next column of DataGrid and no in the next WinForm Control.
0
by: Luis Esteban Valencia | last post by:
Once a user clicks "add new row", a new row is created in my Datagrid. The datasource is huge so they have to scroll to the bottom of the page to edit the data in the new row. I have come across...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
2
by: Ville Mattila | last post by:
Hi there, I will post my question to this group too bacause the .data group seems to be rather quiet. I've been playing with VB.NET and ADO for a week now and find the different data handling...
8
by: Sid666 | last post by:
Hi, everyone I'm building an Access DB system using VBA. I have a ActiveX DTPicker so the user can select a date. This date is put in another textbox that is bound to a table. I do this because...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.