The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Binding Source CancelEdit

Last post 04-19-2007, 7:19 AM by Mike.Griffin. 4 replies.
Sort Posts: Previous Next
  •  02-13-2007, 11:02 AM 254

    Binding Source CancelEdit

    I have a grid bound to a binding source which is bound to a es object. I can add and delete new records but if I edit a new record and cancel the edit with a

    Code:
    _bindingSource.CancelEdit
    it deletes the new record added to the grid. It doesn't delete records that were loaded from the database.

     

  •  02-14-2007, 5:45 AM 283 in reply to 254

    Re: Binding Source CancelEdit

    CancelEdit() will cancel all changes since the last call to EndEdit(). If you add a record, edit it, then call CancelEdit(), the record will be removed along with the changes. To persist changes in the control, call bindingSource.EndEdit() and collection.Save(). Does that answer your question?
    David Neal Parsons
    www.entityspaces.net
  •  02-14-2007, 10:09 AM 293 in reply to 283

    Re: Binding Source CancelEdit

    Kind of. I really didn't want to save the work to the database till the user was all done. But give them the ability to edit records they have been adding to the collection/grid. This is a project that I'm moving from dOOdads to es and adding data bindings. Under the old way I just did all my work in memory then save to the database when I was all done so I only had 2 calls to the database, 1 to load if they were editing a save batch and another to save when they were done. If I have to save every record the user is adding that could be up to 50 calls to the database by one user, with a user base of about 5 that could be about 250 calls to the database for saves alone during data entry. If this is the only way to solve the ability edit a record newly added record with the ability to "cancel" a edit and roll back to what was first entered then I just might have to lose that ability.

    Any idea's? Or am I just doing this all wrong?

  •  04-19-2007, 6:37 AM 1908 in reply to 293

    Re: Binding Source CancelEdit

    I too am trying to do something similar to this.  Basically, I have a set of child records for an employee - lets call them jobs which are bound to a datasource which is bound to a datagridview.  If I create a new row, and call EndEdit() on that row, but then I re-edit that row and call Cancel(), shouldn't it go back to the state when EndEdit() was last called regardless of what's in the db?

     

  •  04-19-2007, 7:19 AM 1910 in reply to 1908

    Re: Binding Source CancelEdit

    We will be testing this soon, I cannot recall how this works? We have a RejectChanges() method that should undo any local changes made and I'm pretty sure CancelEdit should do that.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML