Access Field Items Within a List

Topics: Customizing Orchard
Jul 14, 2011 at 4:05 PM


I am trying to create a custom list view that is rendered as a drop-down menu.  As far as the menu itself is concerned, I have no issues.

However, I would like to add two textfield fields for the background image for the drop-down list and for the background.  Is it possible to access

these from the view (Parts.ContainerWidget-url-product.cshtml being the custom view)?  If not, is it possible to access the list (not the fields) from the widget level?


Jul 14, 2011 at 6:35 PM

Can you read those posts and tell me if it helps? and

Did you first try to cutomize the summary template for the items themselves (instead of the list)?

Jul 14, 2011 at 7:52 PM

The second link is what I used to figure out what to use in the first place.  Im not sure the first link would help as I have a working template, I just need to access added field items.

I did not try to override the summary template for the items as I am displaying a containable content-type in a list.  I have the menu for it rendering just fine, but I would like a little customization available.  As such I added two fields, 'menubackground' and 'listbackground'.  I need to access these items to set them.  I have them hardcoded right now, but if it were dynamic it would be much easier to change.

The template I listed above allows me to display the list; I clicked the create button to do so and can access the list's items with 'IEnumerable listItems = Model.ContentItems'.   I notice what you used in your examples were blog posts. This raises a problem for me. If I go through the shape tracer, the list shape only has 'ContentItems' with 'Tag', 'ItemClasses' and 'ItemAttributes' beneath.  It does not have a 'ContentItem', which is where fields seem to be stored.  The items I wish to use are listed on the same level if I go to a different page to peek at the shape tracer.  The fields seem to be listed on the same level as the list in the container.

Are you saying that the best way would be to add a field to each item, or is there another way?

Jul 26, 2011 at 1:09 AM

Fields are always on a content part. Maybe shape tracing is not showing you the full story here. You might want to attach a debugger and break at that point in order to inspect the shape directly.