Click here to Skip to main content
15,921,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
On a form with a DataGrid I want to allow users to edit data but not actually post to the database until they press the save button and if they press the cancel button I want for all changes made in the Grid to the data to be undone. How can I do this?

Donnelly
Posted

Easy - don't write the bound dataset back to the database until the user clicks the "Save" button. If the user clicks cancel, either dispose the dataset (or reload it from the database).
 
Share this answer
 
On a form with a DataGrid I want to allow users to edit data but not actually post to the database until they press the save button
Well, actually you don't need to do anything for this. It's the other way round - you need to write certain code for saving it while filling. If you need a trigger then sit and relax. Let users fill in the data and hit 'save' button.

press the cancel button I want for all changes made in the Grid to the data to be undone
On Cancel press, rebind the grid with the old existing data. That will refresh back to old state.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900