This project is read-only.

Field not getting displayed

Topics: General
Sep 7, 2012 at 8:53 PM


I try a bit to fiddle around in Orchard. At this moment I work with the most out of the box solution. I added a Field in the Page ContentType and assigned a value to this field in the homepage. (TestField as Text Field).

I created a renderer for the page object called Content-Page.cshtml. This works and the renderer is used. Now I try to show the value of TestField. I did this with this code:  @Display(Model.ContentItem.Page.TestField.Value) (tried it with Value and without.) No result is getting back. Designer Tools show the property, but say that the value is null, though in the admin screen it is filled.

What am I doing wrong?


Sep 12, 2012 at 6:30 PM

Display is for shapes. @Model.ContentItem.Page.TestField.Value should work in a regular part template, but I think the problem here is that you overrode Content-Page, which is a template for a zone shape, not for a part's shape. Thus, Model is the zone shape. Is Model.ContentItem working with anything else or is it a Nil?

Sep 16, 2012 at 3:27 PM

Hi Bertrand,


I tried what you said. If I just write @Model.ContentItem.Page.TestField.Value I get no result, if I do a @Model.ContentItem.Page.TestField.Name I get TestField as a result. When I inspect the value I see null as value. 

I created above snippet collection with parts of my config to show what I did. Am I missing something?



Sep 16, 2012 at 9:24 PM

I don't know. Put a breakpoint into the field driver and inspect the field from there, in particular the storage.