views:

160

answers:

1

Here's the situation:

ListBox has a ItemSource that gets its display and value data from Table A:

Table A
ID    Activity
1     Skiing    
2     Hiking    
3     Fishing

TableB has a list of people

TableB
ID    Name
1     Tom
2     Dick
3     Harry

TableC is an xref that joins up a list of people with their preferred activities...

TableC
UserID   ActivityID
1        1
2        1
2        2
3        2
3        3

What I'd like to ultimately show is a CHECKED list box. When a specific person is selected, I'd like to display ALL the available activities from table A, with the activities to which the person is mapped shown as checked. Better still, I'd like to be able to select/de-select the various activities, and through the modern miracle of databinding, have TableC be updated.

e.g.

Person:  Harry
Activities:
             _  Skiing
             X  Hiking
             X  Fishing

I know I could pull this off using some an SP to return two columns, the activity, and if the activity is mapped to the user, but I'm wondering if there's already some built-in way to make this happen.

Thanks, Mike

A: 

I guess I'm a bit late to answer the question, but still wanted to help... do you have a business layer which actually stores these tables in form of objects like a collection of members and a collection of activities which they can be associated to?

If yes, then it can be done. Also, I assume that the application is being developed in WPF. So the MVVM pattern can be used here to provide an easy implementation.

Trainee4Life