Check list box and businessListBase

Check list box and businessListBase

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


ajj3085 posted on Thursday, September 14, 2006

Hi,

I know this was posted about before, but the post is gone, and I don't think we hand many solutions anyway.

I'd like to use the checklistbox with a business list base.  Now, the box should list all possible options.  The actual business list should only contain items which are checked.

The use case is that one company is selected, and a department within that company is selected.  A list of the other departments is displayed; these departments can be selected and shall be merged into the first department selected. 

One solution would be to build a business list (which would be very simlar to another list I already have) and adding a Selected property.  The list when asked to 'save' itself would only operate on the objects which have IsSelected set to true.  I'm not sure if this is justified (because the use case stipulates that some objects can be selected to be worked upon) or if this is building a business list based on UI requirements.   I can see how both can be argued, and can't figure out which is the 'correct' answer.

Another solution would be a collection on the UI layer with another class that encapsulates the business objects contained in the list and adding an IsSelected property there.  This class would listen for changes to the IsSelected and add / remove the object from the 'real' business collection. 

Which way is the recommended way?

Thanks
Andy

RockfordLhotka replied on Thursday, September 14, 2006

I don't have a difinitive answer, because I haven't tried to do this. But my first instinct is to say that you are describing a UI artifact, and that you should construct a view over the collection.

In fact, I recall this older thread you mention, and I remember suggesting at that time that something along the lines of SortedBindingList or FilteredBindingList - only SelectedBindingList - would be the preferred answer (if it can be made to work).

ajj3085 replied on Thursday, September 14, 2006

Thanks Rocky.  Perhaps I didn't get to read your answer before the older thead vanished... or maybe I just missed it.   I'll go the UI view route.

miroslav replied on Tuesday, September 19, 2006

ajj3085:
Thanks Rocky.  Perhaps I didn't get to read your answer before the older thead vanished... or maybe I just missed it.   I'll go the UI view route.


Hi Andy,
I was wondering how far did you come with your "UI view route"?
As for myself, I've used another approach with child objects having Selected property, but I see the point in Rocky's "avoid the UI artifact" suggestion.

Miroslav

ajj3085 replied on Wednesday, September 20, 2006

I haven't gotten to work on this  yet; got sidetracked into other featuers.

Copyright (c) Marimer LLC