473,241 Members | 1,633 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,241 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 3784
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: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.