In a template for my slideshow document type I want to render all the items added to a Nested content property:
In the slideshow document type I have a property called slides
slides property is a Umbraco.NestedContent datatype with one document type (nested_slides) in its configuration
nested_slides document type has two properties: slide (content picker data type) and foo (textstring - used just for testing/debugging)
In my template I have this code:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@using ContentModels = Umbraco.Web.PublishedModels;
@{
Layout = null;
}
@{
var items = Model.Value<IEnumerable<IPublishedElement>>("slides");
foreach(var item in items)
{
var slide = item.Value<IPublishedElement>("slide");
var foo = item.Value<string>("foo");
<p>slide: @slide.Id, foo: @foo</p>
}
}
The code above is for proof of concept, but it gives an error in line 14:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1503: Argument 1: cannot convert from 'method group' to 'HelperResult'
Source Error:
Line 12: var foo = item.Value<string>("foo");
Line 13:
Line 14: <p>slide: @slide.Id, foo: @foo</p>
Line 15: }
Line 16: }
I want to get the id of the linked node so I can call Umbraco.Content to get the content of that linked node.
Rendering nested content with items with content picker property: Argument 1: cannot convert from method group to HelperResult
Hi forum,
In a template for my slideshow document type I want to render all the items added to a Nested content property:
In my template I have this code:
The code above is for proof of concept, but it gives an error in line 14:
I want to get the id of the linked node so I can call Umbraco.Content to get the content of that linked node.
What am I doing wrong?
Hi,
Just encapsulate it in brackets and it works.
is working on a reply...