The LBTT Spot
"Lifeline is focused on developing and marketing systems designed to assist in the early detection of breast and ovarian cancer."
C# Source Code Viewer
View C# Source Code
Article Categories:
.Net Framework
.Net Framework 1.1
ADO.NET
ASP.NET
Assemblies
Asynchronous Methods
C#
Collections
Configuration
Delegates
Events
Pocket PC
Regular Expressions
Smart Devices
SQL Server
Visual C#
Visual Studio .NET
Visual Studio .NET 2003
Windows Forms
XML
C# .Net Fun Menu
View Current Page's ASP.NET Source Code
C# Reference
C# Study Flash Cards
Valuable Links
Contact Us
Site Map
Mike's Portfolio
C# Reference Search:
Full Text Search:
Articles by Author:
Mike G.
Code Examples (zipped):
MTGUpTime.zip
ThreadLockingE...
ThreadingExamp...
RemotingExampl...
ErrorProviderE...
DelegateExampl...
CustomArrayLis...
AsynchronousEx...
C# .Net Source Code for /Articles/WindowsForms/DataGridBindingAdapterProblem.aspx
This ASP.NET page was written by Mike G.. <% @ Page Language="C#" Debug="True" %> <% @ Register TagPrefix="DotNetFun" TagName="Header" Src="/Header.ascx" %> <% @ Register TagPrefix="DotNetFun" TagName="Footer" Src="/Footer.ascx" %>
<%# CtrlHeader.ArticleTitle %>
<%# CtrlHeader.ArticleDescription %>
Category:
Posted
<%# CtrlHeader.AuthorDate.ToShortDateString() %>,
By
<%# CtrlHeader.AuthorName %>
" />
When a user places a cursor on a DataGrid cell in order to edit its contents, the grid is placed into an Edit mode state. If the user later clicks on a save button to commit the changes to a database, the changes may not be saved. This occurs because the DataGrid is still in Edit mode. For this reason, I recommend to all developers that the form, on which the DataGrid resides, be used to end the Edit mode session of the DataGrid. You can do this by issuing it a BindingManagerBase.EndCurrentEdit() before saving the data as follows:
private void SaveMethod() { // This will end any opened edit mode sessions on the DataGrid: this.BindingContext[this.dgMyDataGrid.DataSource].EndCurrentEdit(); // Now we can save the changes via an Adapter update: if (dsMyDataSet.GetChanges() != null) { sqlAdapter.Update(dsMyDataSet.GetChanges()); dsMyDataSet.AcceptChanges(); } }