473,396 Members | 1,703 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,396 software developers and data experts.

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 3791
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
2
by: Manish | last post by:
Hey folks I am having a weird problem in ASP .Net. My page is in C#. I have a datagrid, which populates based on selection in drop down box on ASP page. This datagrid has template textbox colum in...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass =...
3
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.