views:

17

answers:

1

It's simple. I have three tables, for example: Persons(ID, Name, etc.) Lessons(ID, ClassroomID, Description, Etc.) Person_Lesson_Link(PersonID, LessonID) The third table links the two others in an N:M relationship. A person can follow multiple lessons, and a lesson is given to multiple persons. I've created an entity model around these tables, which only shows the Perssons and Lessons tables and which links the two. I've also created a Dynamic Data website which will allow me to work with these tables, adding, editing and removing records as needed. But I still need to know a few things, in the following priority:

  1. I need to filter the Persons based on a lesson. So a filter is needed which shows the lessons.
  2. I need to add a link between a Person and a Lesson. Or edit a link, or drop a link.

So, any examples on how to do this, without having to write lots and lots of code? (Main problem: I have about 15 of these linked tables, so I need something generic.)

+1  A: 

There is standard Dynamic Data field template for editing Many-To-Many relationships in .NET4.0 based on CheckListBox. Download VS2010 and grab templates from there.

Also you can create Filter Template based on this field template for filtering Many-To-Many relationships.

gandjustas
Yeah, I know. Haven't convinced management here to upgrade to VS2010 yet, though. Your second suggestion sounds better. Is there any example code for that somewhere on the Internet?
Workshop Alex
http://blogs.msdn.com/b/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx This control was included in .NET 4.0
gandjustas