Solved

Edited Entity should not commit changes only when Save button is pressed

Posted on 2010-08-17
1
363 Views
Last Modified: 2012-05-10
Hello,

I have a Mainform + smallDialog.

scenario:

The Mainform has a datagrid with entities bound.

The smallDialog updates the entity double-clicked-on-the-datagrid-in-Mainform wich is passed to the smallDialog and bound there again to a bindingsource.

When I change now some data in the textfiels AND leave the textfield so the focus is lost, the data is immediate updated in the datagrid of the Mainform.

What I want is to update ONLY when the OK-button is pressed.

How can I change that update-behaviour without cloning the entity and do many workarounds?
0
Comment
Question by:MSFanboy
1 Comment
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33465085
Hi MSFanboy;

You can use the BindingSource.SuspendBinding to cause the updating of bound fields to not take place until you enable updates with BindingSource.ResumeBinding. Please take note from Microsoft documentation :

Using SuspendBinding and prevents changes from being pushed into the data source until ResumeBinding is called, but does not actually prevent any events from occurring. Controls that use complex data binding, such as the DataGridView control, update their values based on change events such as the ListChanged event, so calling SuspendBinding will not prevent them from receiving changes to the data source. For this reason, this SuspendBinding and ResumeBinding are designed for use with simple-bound controls, such as the TextBox control. Alternatively you can use these methods in a complex binding scenario if you suppress ListChanged events by setting the RaiseListChangedEvents property to false.

Fernando
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 83
Angular - break the dataset in chunks? 7 51
ASP.NET 5 Templates 2 78
Wav problem 4 27
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question