468,549 Members | 2,050 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,549 developers. It's quick & easy.

Ideas on How to handle datagrid update

Hello All,
I'm trying to discover the best way to handle the situation where you have a
datagrid in your app and someone changes a cell but doesn't leave that cell
(so there's the little pencil icon on the left margin of the datagrid) and
then the user clicks a menu to save the data in the datagrid. You see, my
problem is that at this point, the table attached to the datagrid hasn't
been updated because the user never left the cell they changed of the
datagrid. Is there a way to update the table attached to the datasource when
the datagrid looses focus? Maybe switching rows in the datagrid when it
looses focus would make the datagrid update to the table?
Thanks for any input...

Cheers :)
Nov 15 '05 #1
2 3643
Hello Randy,

The following has worked for me:

1. Call EndEdit() on the grid.
2. Obtain a CurrencyManager instance for the grid through the form's
BindingContext property and call EndCurrentEdit() on that instance.

Step 2 ensures the row state in the bound table will be set to
added/modified, as the step 1 only pushes the data but does not update the
row state.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Randy" <te**@temp.com> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl...
Hello All,
I'm trying to discover the best way to handle the situation where you have a datagrid in your app and someone changes a cell but doesn't leave that cell (so there's the little pencil icon on the left margin of the datagrid) and
then the user clicks a menu to save the data in the datagrid. You see, my
problem is that at this point, the table attached to the datagrid hasn't
been updated because the user never left the cell they changed of the
datagrid. Is there a way to update the table attached to the datasource when the datagrid looses focus? Maybe switching rows in the datagrid when it
looses focus would make the datagrid update to the table?
Thanks for any input...

Cheers :)


Nov 15 '05 #2
Thanks Dmitriy, works like a charm...

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:OP**************@TK2MSFTNGP12.phx.gbl...
Hello Randy,

The following has worked for me:

1. Call EndEdit() on the grid.
2. Obtain a CurrencyManager instance for the grid through the form's
BindingContext property and call EndCurrentEdit() on that instance.

Step 2 ensures the row state in the bound table will be set to
added/modified, as the step 1 only pushes the data but does not update the
row state.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Randy" <te**@temp.com> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl...
Hello All,
I'm trying to discover the best way to handle the situation where you have
a
datagrid in your app and someone changes a cell but doesn't leave that

cell
(so there's the little pencil icon on the left margin of the datagrid)

and then the user clicks a menu to save the data in the datagrid. You see, my problem is that at this point, the table attached to the datagrid hasn't
been updated because the user never left the cell they changed of the
datagrid. Is there a way to update the table attached to the datasource

when
the datagrid looses focus? Maybe switching rows in the datagrid when it
looses focus would make the datagrid update to the table?
Thanks for any input...

Cheers :)

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Glenn Owens | last post: by
2 posts views Thread by Manish | last post: by
3 posts views Thread by Jim Heavey | last post: by
reply views Thread by Steve | last post: by
3 posts views Thread by D. Shane Fowlkes | last post: by
5 posts views Thread by junglist | last post: by
5 posts views Thread by Tina | last post: by
9 posts views Thread by rn5a | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.