Add and Delete in BusinessList

Add and Delete in BusinessList

Old forum URL: forums.lhotka.net/forums/t/5178.aspx


vijay posted on Thursday, July 31, 2008

I have following set of objects in for the user screen. There are other children also but this where i have doubt

EditableRootParent  => Editable Child List  => Editable Child

List is binded with Grid View on screen where user can configure (change/Add/Deelte) information. For the list i need to show Add and Delete button which works as:

Add button: When user clicks on Add button it should add blank record at the end of the grid. User can click Add button multiple times and i need to add as many rows without inserting records actually in database table.

Delete button: When user clicks on Delete button it should remove last rwo from the grid. Again user can click multiple times on Delete button to remove multiple records but not from database table.

Finally we have Save button. I need to save all this information in database when this is called. Can anyone point me in right direction to implement this.

Env used : VS 2008, CSLA 3.0

Thanks

Lalit replied on Thursday, July 31, 2008

Hi Vijay,

I think you should invest some of your time to look into the ProjectTracker example first. That will provide you all answers related to implementation of parent-child relationship. Only after that it will be meaningful to discuss things here.

rsbaker0 replied on Thursday, July 31, 2008

You can actually do what you are trying with a BusinessListBase (BLB) derived class, not EditableRootListBase (ERLB) -- BLB doesn't try to persist any changes to the data store automatically, and you can save all changes made to the list in a single method invocation and database transaction.

You'll find that at least the default implementation ERLB is more aggressive about saving each object separately.

You could also override the Save() implementation of our ERLB to override the default behavior and defer saving/updating the objects to a later method that traverses the list and saves the modified or new objects directly.

Copyright (c) Marimer LLC