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?
System environment:
VS 2008 SP1, .net framework 3.5 sp1, entity framework, using the dynamic data samples project
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)
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)
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.
and
Michael MacGregor
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.)
Dynamic DataMany to Many (M:M)
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
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?
Check out www.Primershee.com, a Project Management Tool which I designed especially for the Solo Website Developer.
fireUnder
Member
1 Points
5 Posts
Many to Many relationship - Insert and Edit mode differences
Jul 16, 2009 07:17 PM|LINK
hello fellas,
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?
System environment:
VS 2008 SP1, .net framework 3.5 sp1, entity framework, using the dynamic data samples project
Dynamic Data Entity Framework Many to Many (M:M)
andreadottor
Contributor
2060 Points
312 Posts
MVP
Re: Many to Many relationship - Insert and Edit mode differences
Jul 17, 2009 07:09 AM|LINK
You can use the Field Template Many to Many that have post Dadiv Ebbo:
http://blogs.msdn.com/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx
this field template display a checkbox list in edit and in insert mode.
Andrea Dottor
Microsoft MVP - ASP/ASP.NET
http://blog.dottor.net
fireUnder
Member
1 Points
5 Posts
Re: Many to Many relationship - Insert and Edit mode differences
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)
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Many to Many relationship - Insert and Edit mode differences
Jul 17, 2009 04:32 PM|LINK
Hi fileUnder, are you using a UIHint to identify which Column.
Dynamic Data Many to Many (M:M)
Always seeking an elegant solution.
fireUnder
Member
1 Points
5 Posts
Re: Many to Many relationship - Insert and Edit mode differences
Jul 17, 2009 05:38 PM|LINK
Hello Steve,
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.
http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27026
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)
http://blogs.msdn.com/davidebb/archive/2008/10/25/a-many-to-many-field-template-for-dynamic-data.aspx
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.
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Many to Many relationship - Insert and Edit mode differences
Jul 17, 2009 08:23 PM|LINK
Have you tried Preview 4 Refresh?
Dynamic Data Many to Many (M:M)
Always seeking an elegant solution.
fireUnder
Member
1 Points
5 Posts
Re: Many to Many relationship - Insert and Edit mode differences
Jul 17, 2009 08:27 PM|LINK
Yes, i tried the preview 4 refresh downloaded from the link below:
http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27026
sjnaughton
All-Star
27320 Points
5459 Posts
MVP
Re: Many to Many relationship - Insert and Edit mode differences
Jul 20, 2009 08:54 AM|LINK
Hi FireUnder, I asked the team and
and
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.)
Dynamic Data Many to Many (M:M)
Always seeking an elegant solution.
fireUnder
Member
1 Points
5 Posts
Re: Many to Many relationship - Insert and Edit mode differences
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.
wmild
Member
146 Points
47 Posts
Re: Many to Many relationship - Insert and Edit mode differences
Jan 28, 2010 03:17 PM|LINK
Hi Steve,
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?