Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 19, 2010 03:01 PM by klca
Jul 16, 2009 07:17 PM|LINK
Most of you know that in the northwind database, employees and territories tables have a many to many relationship.
When inserting a new employee I want to assign the territories at the same time and on the same screen. I am missing the territories checkbox list in the insert mode.
I am able to acheive this by inserting the employee first and then by going to EDIT mode to assign the territories.
How do I make the territories check box list available in the insert mode?
VS 2008 SP1, .net framework 3.5 sp1, entity framework, using the dynamic data samples project
Many to Many (M:M)
Jul 17, 2009 07:09 AM|LINK
You can use the Field Template Many to Many that have post Dadiv Ebbo:
this field template display a checkbox list in edit and in insert mode.
Jul 17, 2009 02:35 PM|LINK
Yes, i tried his code.
when i tried to add a new employee(insert mode), ManyToMany_Edit.ascx isn't executed
When I set a breakpoint on 'Page_Load' of ManyToMany_Edit, it doesn't even get there.
When I set a breakpoint on the onLoad method of Default_Edit.ascx.cs(in EntityTemplates) I noticed the following:
Table.GetScaffoldColumns(Mode, ContainerType) gives the columns of type MetaColumn and MetaForeignColumn.
In addition to the MetaColumn and MetaForeignCOlumn, MetaChildrenColumn column is loaded only in edit mode (which is triggering to load the manytoMany_Edit.ascx)
Jul 17, 2009 04:32 PM|LINK
Hi fileUnder, are you using a UIHint to identify which Column.
Many to Many (M:M)
Jul 17, 2009 05:38 PM|LINK
I am working on one of the samples downloaded from the Codeplex(link below). It doesnt seem to use UIHint for this functionality. Please correct me if I am wrong.
Checkboxlist is available in the edit mode but in the insert mode.
Lets say in northwind database, when inserting a new employee I should be able to select a list of territores the employee would be working on.(checkbox list control in this sample)
In this article, david seems to got it working in both edit and insert mode but unfortunately its not working for me.
Moreover, the sample that I downloaded from codeplex is newer than the david's sample and essentially has the same code.
Jul 17, 2009 08:23 PM|LINK
Have you tried Preview 4 Refresh?
Jul 17, 2009 08:27 PM|LINK
Yes, i tried the preview 4 refresh downloaded from the link below:
Jul 20, 2009 08:54 AM|LINK
Hi FireUnder, I asked the team and
Indeed, it doesn’t currently support directly adding to the Many to Many relationship from insert mode. E.g. when inserting an employee, you can’t attach territories to it until you first create the employee and put it in Edit mode. Doing it directly from
the Insert page may not be that easy, due to the nature of the relationship.
The issue was that with this relationship, you couldn't add a record in the lookup table until both sides of the relationship had primary key.
And having thought about the scenario my self I can't see it happening unless when you save in insert mode you switch to edit to add the Many to Many stuff. (note it's relativly easy to switch to edit mode from insert save, as many have asked for switch
directly to Details from insert and edit.)
Jul 20, 2009 01:20 PM|LINK
Hmm, I dont think I can even try explaining that to the business users. I'll try to do a work around to make it work.
Thanks Steve. I sincerely appreciate your help.
Jan 28, 2010 03:17 PM|LINK
I found this point on many-to-many support in dynamic data with Insert. I am just reaching out to inquire if you are aware of any progression in thought on this limitation from 6 months ago? Perhaps a new update coming or something like that?