I need List Item view to also display content from list parent

Topics: Customizing Orchard
Apr 10, 2012 at 4:32 PM
Edited Apr 10, 2012 at 4:33 PM

Hi

We're trying to customize the view for a containable content type to display the Body part from the parent container, as well as the content from the containable item, and I can't figure out how to do this.

We're building a site that will display a few lists of cookery courses, and each list will display a number of courses. Each cookery course will also have a number of Dates showing when the course is running.

So we have set up a "List" content type for Courses, which lists all the cookery courses, each cookery course is itself a "List" content type containing list items for course dates.

We want to customize the view for the Cookery Course Dates to display the Body part from it's parent list - i.e. the Cookery Course description, so when you click into the view for the Course Dates - you don;t just seen the date fields, but also see the course description that is pulled through from the parent item.

Anyone any ideas?

We're using Orchard 1.3.10

Coordinator
Apr 12, 2012 at 12:15 AM

Model.ContentItem.CommonPart.Container.BodyPart.Text or something along those lines should do the trick.

Apr 12, 2012 at 10:11 AM

Hi Bertrand

Thanks for that - that is exactly what I need. Can you perhaps help me with one further area then - how could I have found that out for myself?

I have been delving through documentation, code and objects trying to understand the structure of the Model object and what data it may contain. As it's a dynamic object I've been using Debug in Visual Studio and trying to drill down into the object, but when I refresh the content for the object I get "No further information on this object could be discovered" as shown below:

Object Refresh message

So do you know how can I explore the Model object and understand better how it is generated?

 

Many thanks for your help so far

Simon