CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

EditableRootList in asp.net

Last post 06-08-2007, 3:21 PM by RockfordLhotka. 3 replies.
Sort Posts: Previous Next
  •  06-05-2007, 12:06 PM 15208

    EditableRootList in asp.net

    Does anyone have a quick example of using an EditableRootList with an updatable grid in asp.net code.

    I can't quite work out the code for the CSLADatSource_SelectObject, UpdateObject, InsertObject and DeleteObject.

    Thanks,

    Bill 

  •  06-06-2007, 10:41 PM 15251 in reply to 15208

    Re: EditableRootList in asp.net

    Hmm, it isn't really designed for the web - I created it to support a scenario for Windows Forms (and now WPF).

    However, it should work in the web as long as you keep it in session.

    The SelectObject would be like any other collection - no difference there.

    But the Update/Insert/Delete handlers would be different. You need to

    1. Get the list from Session
    2. Locate the index of the item to be saved
    3. Update that object with values from data binding (or mark it as deleted)
    4. Call theList.SaveItem(index)
    5. Rebind the UI to the list (because step 4 may have changed that item)

     


    Rocky
  •  06-07-2007, 12:08 PM 15267 in reply to 15251

    Re: EditableRootList in asp.net

    Rocky, thanks for the reply.

    I have just tried a simple test using Delete and the DataSource_Delete handler is not firing when I delete from the grid.

    I have debugged this and the CanDelete Property in CslaDataSourceView is returning False:

        Public Overrides ReadOnly Property CanDelete() As Boolean
          Get
            If GetType(Csla.Core.IUndoableObject).IsAssignableFrom( _
              CslaDataSource.GetType(mTypeAssemblyName, mTypeName)) Then
              Return True
            Else
              Return False
            End If
          End Get
        End Property

    The code is the same for the CanInsert and CanUpdate.

    Do you have any idea of how I could work around this.

    Thanks,

    Bill

     

     

  •  06-08-2007, 3:21 PM 15313 in reply to 15267

    RE: EditableRootList in asp.net

    Hmm, that’s an interesting issue that I hadn’t thought about…

     

    Obviously ERLB isn’t undoable itself. I wonder, however, if the check shouldn’t be a little broader. I should be able to see if IBindingList is implemented, and if so I can get the true/false answer from that interface.

     

    Something to add to the to-do list.

     

    Rocky

     

     

    From: Blarm [mailto:cslanet@lhotka.net]
    Sent: Thursday, June 07, 2007 12:09 PM
    To: rocky@lhotka.net
    Subject: Re: [CSLA .NET] EditableRootList in asp.net

     

    Rocky, thanks for the reply.

    I have just tried a simple test using Delete and the DataSource_Delete handler is not firing when I delete from the grid.

    I have debugged this and the CanDelete Property in CslaDataSourceView is returning False:

        Public Overrides ReadOnly Property CanDelete() As Boolean
          Get
            If GetType(Csla.Core.IUndoableObject).IsAssignableFrom( _
              CslaDataSource.GetType(mTypeAssemblyName, mTypeName)) Then
              Return True
            Else
              Return False
            End If
          End Get
        End Property

    The code is the same for the CanInsert and CanUpdate.

    Do you have any idea of how I could work around this.

    Thanks,

    Bill

     

     




    Rocky
View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems