Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In a macro settings, featuredContent is assigned from a Content picker and it is a IContentPageBase.
This is my code in the macro view: var content = Umbraco.Content(Model.MacroParameters["featuredContent"]) as IContentPageBase;
but content is null. How can I get IContentPageBase from the featuredContent param value? Please help!
Umbraco 8 or 7?
It is Umbraco 8, Søren. Is it a dynamic object in the macro then cast it can'r be cast?
Umbraco.Content should give you IPublishedContent, which should be possible to cast as the interface from ModelsBuilder.
Can you shee if Umbraco.Content() without the casting gives you anything?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How casting IPublishedContent to its derived type
In a macro settings, featuredContent is assigned from a Content picker and it is a IContentPageBase.
This is my code in the macro view: var content = Umbraco.Content(Model.MacroParameters["featuredContent"]) as IContentPageBase;
but content is null. How can I get IContentPageBase from the featuredContent param value? Please help!
Umbraco 8 or 7?
It is Umbraco 8, Søren. Is it a dynamic object in the macro then cast it can'r be cast?
Umbraco.Content should give you IPublishedContent, which should be possible to cast as the interface from ModelsBuilder.
Can you shee if Umbraco.Content() without the casting gives you anything?
is working on a reply...