473,614 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 foldersToDBsJoi nDataGridView_R owLeave(object sender,
DataGridViewCel lEventArgs e)
{

fKProjectNamess pFoldersToDBsJo inSelectBinding Source.EndEdit( );

sp_FoldersToDBs Join_SelectTabl eAdapter.Update (tpocsBatchProc essConfiguratio nDataSet);
}

Jun 21 '06 #1
2 1443
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 foldersToDBsJoi nDataGridView_R owLeave(object sender,
DataGridViewCel lEventArgs e)
{

fKProjectNamess pFoldersToDBsJo inSelectBinding Source.EndEdit( );

sp_FoldersToDBs Join_SelectTabl eAdapter.Update (tpocsBatchProc essConfiguratio nDataSet);
}

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 foldersToDBsJoi nDataGridView_R owLeave(object sender,
DataGridViewCel lEventArgs e)
{

fKProjectNamess pFoldersToDBsJo inSelectBinding Source.EndEdit( );

sp_FoldersToDBs Join_SelectTabl eAdapter.Update (tpocsBatchProc essConfiguratio nDataSet);
}


Jun 21 '06 #3

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

Similar topics

6
2183
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
4700
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 datalist is a radiobuttonlist. When this radiobuttonlist is checked, I would like it to iterate thru each row on the child grid and either select or deselct the checkboxes (which are on each row of the child datagrid). In addition, the user can also check...
1
1122
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 Template Columns that contain Web Controls. I want to handle postback events (TextChanges on a TextBox, for example) on Web Controls contained in a Template Column. Does anybody know of a way to write "AddHandlers" for those Sample code, maybe?...
4
2115
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 Datagrid in a Web Custom Control (WCC) : The datagrid has LinkButton Column which has a select LinkButton for each row. When this button is clicked, the Datagrid raises its 'ItemCommand' event which captures the information for that row and...
9
2323
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 into the place holder. This is done dynamically based on the choice they selected. This user control has a datagrid in it that supports paging. When I click on the next or prev buttons of the datagrid in a user control it should display the next page...
2
2130
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 database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the background color of a label on the form the user is looking at. I use red for when the database is...
2
1786
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 existing records, while preventing them from inserting new records from the datagrid itself.
0
1146
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. I have tried Response.write lines to see that I get the correct value for Id and Status for my command. I do not get any errors, but the changes are not made to the database!?!?
0
923
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 update the database. 3. The update fails because there a table constraint has been breached. (Eg. The user typed in a value which is not allowed by the SQL Server table).
0
8179
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8272
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8427
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4119
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1421
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.