Undoing record changes
I have a list box and a set of text boxes bound to a dataSource (or something like that:-) The list box is used to navigate. Everything works just find - add, delete, edit, etc.
HOWEVER, I haven't quite figured out how to make the undo button work:-( It will have two modes.
1. If not editing then undo all changes since last Accept. (You can delete or edit multiple records and undo all the changes. I still have to put in code to allow moving record to accept changes as an option to hitting the accept button.)
2. If editing then undo just the changes to the currently being editted thingie. (I'm being vague here because perhaps if i knew exactly what was being editted I wouldn't be having this problem.) Undo i this mode needs to restore all the text boxes to the state preferably before the current edit, but baring that the state after the last Accept.
#1 works just fine. How do I make #2 work?
Regards,
Al
Al Christoph wrote: |
| I have a list box and a set of text boxes bound to a dataSource (or something like that:-) The list box is used to navigate. Everything works just find - add, delete, edit, etc. HOWEVER, I haven't quite figured out how to make the undo button work:-( It will have two modes. 1. If not editing then undo all changes since last Accept. (You can delete or edit multiple records and undo all the changes. I still have to put in code to allow moving record to accept changes as an option to hitting the accept button.) 2. If editing then undo just the changes to the currently being editted thingie. (I'm being vague here because perhaps if i knew exactly what was being editted I wouldn't be having this problem.) Undo i this mode needs to restore all the text boxes to the state preferably before the current edit, but baring that the state after the last Accept. #1 works just fine. How do I make #2 work? Regards, Al |
|
Al,
For #2, you will have to store the state of the row before you enter the edit state. Once you know you have entered your "edit" state (before changes have been committed), if you cancel, then you can just restore the values that you stored before to the row.
The data row only knows in a general sense if there is an edit, not if multiple edits since the last time it was accepted have been performed.
Hope this helps.
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com