Menu

ObjectViewRow.Begin/End/CancelEdit suggestion

marcelo
2005-10-05
2013-03-07
  • marcelo

    marcelo - 2005-10-05

    When objectview.addnew is called, a new instance is created and added to the Datasource. If the row canceledit is called the new object is removed from the Datasource.

    Is it a better approach to have a temporary newobject objectview private instance variable that holds the new instance? If endedit is called, in that moment the new instance would be added to the datasource, if canceledit is called, we can dispose that temporary object.

    What do you think?

     
    • Martijn Boland

      Martijn Boland - 2005-10-05

      What will be the advantage of this?

       
      • marcelo

        marcelo - 2005-10-05

        if you have any validation in the iList class over new items added, that validations are raised in new items that are not yet accepted by the user (through an EndEdit).

        If my suggestion is implemented, no validations will be raised until EndEdit

         
    • Donald L Mull Jr.

      AddNew() is part of IBindingList. It is supported to add a new object to the list and return a reference. It's not behavior we can change if we want to work with databound controls. BeginEdit() and EndEdit() are part of another interface, IEditableObject(), which ObjectViews implements.

       
    • Donald L Mull Jr.

      .NET 2.0 has a new intreface for this: System.ComponentModel.ICancelAddNew

      If we move to support .NET 2.0 (which I want) then we can implement this.

       
      • Oran Dennison

        Oran Dennison - 2006-01-23

        I'm also interested in a .NET 2.0 version of ObjectViews.  Could you give a brief overview of what ObjectViews offers above and beyond the new databinding features in .NET 2.0?  Thanks!

         
    • Donald L Mull Jr.

      Mainly just the ability to flatten a fine-grained object model to bind to. (The new framework classes still don't cover this, unless I missed it. I'd like to know if I did :)

       
      • Martijn Boland

        Martijn Boland - 2006-01-24

        No, you didn't miss it. It's a real shame it's not supported because it's pretty useless right now.

        For a .NET 2.0 ObjectView, I suggest looking at extending the BindingSource class (which has a lot in common with ObjectViews).

         

Log in to post a comment.

MongoDB Logo MongoDB