When I have a view or partial which does not inherit from IPublishedContent, ie inherits from a custom view modeI, I cannot seem to display dictionary items in the usual:
If you have a custom model for a view or partial view then instead of defining the model at the top of the view like this:
@model MyCustomViewModel
use an inherits statement and UmbracoViewPage like this:
@inherits UmbracoViewPage<MyCustomViewModel>
This will still give you access to your custom model properties via @Model.Name etc but will also setup the static helpers for things like UmbracoHelper that enable Umbraco.GetDictionaryValue to work...
Dictionary items not displaying
Hi,
When I have a view or partial which does not inherit from IPublishedContent, ie inherits from a custom view modeI, I cannot seem to display dictionary items in the usual:
How can I get round this?
Hi Damion
If you have a custom model for a view or partial view then instead of defining the model at the top of the view like this:
use an inherits statement and UmbracoViewPage like this:
This will still give you access to your custom model properties via @Model.Name etc but will also setup the static helpers for things like UmbracoHelper that enable Umbraco.GetDictionaryValue to work...
regards
Marc
is working on a reply...