Dynamic Binding Listbase usage

Dynamic Binding Listbase usage

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


Arjun posted on Wednesday, January 09, 2013

Hi,

I am using CSLA in a windows application. The types of forms I develop are

1. List Forms : which generally inherit from ReadOnlybindingListBase, to just display a list

2. Detail Forms : inherits from BusinessBase, to implement Add, Edit, Remove operations.

The general scenario: Click "Add" button in List form, the corresponding detail form will be populated. fill the details, click OK , the entered values will be saved to database. Refresh the list form to see the newly added item populated.

But, I have a  requirement where a detail form adds data to the list (not to the database). When the user done with adding list items, when he clicks save, all the added items must be saved to the database.

I tried using DynamicBindingListbase, which is trying to insert an item after each item navigation, which is not i wanted. The control should wait for the user to click "Save".

Then i tried BusinessBindingListBase, which is making an item editable at the grid level which does not suit my requirement.

Please suggest me which class to be used.

 

Thanks,

Arjun

 

Peran replied on Wednesday, January 09, 2013

Hi Arjun,

You are correct to use BusinessBindingListBase, just make the grid read only to prevent the user making changes in the grid.

When the user double clicks on a row, bind the child BusinessBase object from the collection to your Detail Form.  When you have changed multiple records, call Save on the collection to save all the modified child BusinessBase objects in one go.

 

Regards

Peran

Arjun replied on Thursday, January 10, 2013

Hi Peran,

Thanks for the reply. I have started using BusinessBindingListBase as you suggested.

 

 

Arjun replied on Thursday, January 10, 2013

Hi Peran,

Thanks for the reply. I have started using BusinessBindingListBase as you suggested.

 

 

 

Copyright (c) Marimer LLC