This project is read-only.

ContentPart is displayed in one ContentType but not in other

Topics: Customizing Orchard, Writing modules
Aug 29, 2011 at 4:26 PM
Edited Aug 29, 2011 at 6:01 PM

I have implemented a custom ContentPart "MarinaPart", which also defines a new ContentType "Marina":


public int UpdateFrom5()
							 cfg => cfg
			return 6;


The ContentPart "Map" is the one I developed according to the tutorial:

Everything is working fine except that the Shapes of the "Map" are not showing. I open up an existing ContentItem of the ContentType "Marina", and it does not show the Edit-View of "Map". Though while debugging it does enter the Driver for the Editor.

I have added the ContentPart "Map" to the ContentType "Page" (via the Dashboard), and there everything works fine. But strangely while debugging the Editor-Driver is not entered, but the Shape is displayed.

Can someone explain to me, what I may have done wrong? (I hope that there it makes not much of a difference that I added the "Map"-ContentPart one time via Code and one time via Dashboard.)

Aug 29, 2011 at 8:27 PM

Missing placement maybe?

Aug 31, 2011 at 4:39 PM

We solved the problem. Here our findings:

The placement files were fine.

The "Map" Module had a migrations.cs-file with this line:

ContentDefinitionManager.AlterPartDefinition(typeof(MapPart).Name, builder => builder.Attachable());

typeof(MapPart).Name results in "MapPart", not "Map", even though the ContentPart is displayed as "Map" in the dashboard. In the code you have to use the string "MapPart".

So the only thing we needed to change was 

		public int UpdateFrom6()
			                                             builder => builder
			return 7;