473,326 Members | 2,126 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,326 software developers and data experts.

Handling Updates in DataGrid

I did have a save button for a datagrid that is bound to a
tableadapter, but I wanted to remove the button and instead save
updates everytime a user finishes editing a row. So I moved the update
code to the below RowLeave event. However, the problem I have is when
moving to the last new row, and then moving out, an attempt is made to
save the new row even if the user did not make any edits on it. When
using the save button before, if the user moved into the alst new row,
the default values(as defined in the tableadapter) would be populated,
but if the user then moved out of the new row without making any edits
or entering data, then the row would not be included the next time the
save button was clicked.

So I could either move the code into a different event handler, or
update the code to discard a new row if the user didn't do any data
entry on it.

In the first case, I'm not sure what a good event handler would be. I
would like to try and make updates everytime a user completes editing a
row, so that updates are made on a per row basis and any related errors
are raised immedietely.

In the second case, I have no idea how to emulate the bahavior of
discarding the last row if it is not edited.

Thanks in advance.

private void foldersToDBsJoinDataGridView_RowLeave(object sender,
DataGridViewCellEventArgs e)
{

fKProjectNamesspFoldersToDBsJoinSelectBindingSourc e.EndEdit();

sp_FoldersToDBsJoin_SelectTableAdapter.Update(tpoc sBatchProcessConfigurationDataSet);
}

Jun 21 '06 #1
2 1434
Try the RowValidated

sh******@cs.fsu.edu wrote:
I did have a save button for a datagrid that is bound to a
tableadapter, but I wanted to remove the button and instead save
updates everytime a user finishes editing a row. So I moved the update
code to the below RowLeave event. However, the problem I have is when
moving to the last new row, and then moving out, an attempt is made to
save the new row even if the user did not make any edits on it. When
using the save button before, if the user moved into the alst new row,
the default values(as defined in the tableadapter) would be populated,
but if the user then moved out of the new row without making any edits
or entering data, then the row would not be included the next time the
save button was clicked.

So I could either move the code into a different event handler, or
update the code to discard a new row if the user didn't do any data
entry on it.

In the first case, I'm not sure what a good event handler would be. I
would like to try and make updates everytime a user completes editing a
row, so that updates are made on a per row basis and any related errors
are raised immedietely.

In the second case, I have no idea how to emulate the bahavior of
discarding the last row if it is not edited.

Thanks in advance.

private void foldersToDBsJoinDataGridView_RowLeave(object sender,
DataGridViewCellEventArgs e)
{

fKProjectNamesspFoldersToDBsJoinSelectBindingSourc e.EndEdit();

sp_FoldersToDBsJoin_SelectTableAdapter.Update(tpoc sBatchProcessConfigurationDataSet);
}

Jun 21 '06 #2
Perfect.

Ian Semmel wrote:
Try the RowValidated

sh******@cs.fsu.edu wrote:
I did have a save button for a datagrid that is bound to a
tableadapter, but I wanted to remove the button and instead save
updates everytime a user finishes editing a row. So I moved the update
code to the below RowLeave event. However, the problem I have is when
moving to the last new row, and then moving out, an attempt is made to
save the new row even if the user did not make any edits on it. When
using the save button before, if the user moved into the alst new row,
the default values(as defined in the tableadapter) would be populated,
but if the user then moved out of the new row without making any edits
or entering data, then the row would not be included the next time the
save button was clicked.

So I could either move the code into a different event handler, or
update the code to discard a new row if the user didn't do any data
entry on it.

In the first case, I'm not sure what a good event handler would be. I
would like to try and make updates everytime a user completes editing a
row, so that updates are made on a per row basis and any related errors
are raised immedietely.

In the second case, I have no idea how to emulate the bahavior of
discarding the last row if it is not edited.

Thanks in advance.

private void foldersToDBsJoinDataGridView_RowLeave(object sender,
DataGridViewCellEventArgs e)
{

fKProjectNamesspFoldersToDBsJoinSelectBindingSourc e.EndEdit();

sp_FoldersToDBsJoin_SelectTableAdapter.Update(tpoc sBatchProcessConfigurationDataSet);
}


Jun 21 '06 #3

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

Similar topics

6
by: HB | last post by:
Guys, PLS tell me How to reset DataGrid to view DB updates? if I refill the dataset it double the records. Thanks HB
1
by: wsyeager36 | last post by:
I have a datagrid inside a datalist. The datalist shows parent info and the datagrid shows the child info for that parent. There is a checkbox on each row of the child datagrid. Also inside the...
1
by: Rich | last post by:
I'm working on a Data Grid app. For a number of reasons (mostly aesthetic) I don't want to use the standard approach with Button Columns for doing updates on a row-by-row basis. I know I can create...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
9
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control...
2
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
2
by: bhooper | last post by:
Does anyone know how I can allow updates to a datagrid while hiding the insert row that appears as the last row in the datgrid control? I want users to be able to update select columns for...
0
by: juustagirl | last post by:
There is only one editable field on my datagrid ... a combo box. The data displays correctly. I have a button to make all the changes .... but they are never written back to my Access database....
0
by: Charlie A | last post by:
This is a short explanation of our problem: 1. A user modifies a row in a DataGrid which causes the DataGrid to update the locally cached DataSet. 2. We call dataAdapter.Update(table) to...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.