Welcome to the forum! There are no silly questions here. :-)
Try it the same way as how you got the first lot of items, like so...
var secondItems = item.Value<IEnumerable<IPublishedElement>>("group");
It's because the Razor template is expecting a certain object type, so it knows how to loop over it. In your original snippet, when you call .Value(), Razor doesn't know that it can be looped over, so it throws an error.
Rendering nested content within another nested content
Hi. Im working on an Umbraco 8.3 project where I need to add a Nested Content data type inside another Nested Content.
I've done a lot of googling and I can only find examples for older Umbraco versions which don't seem to work in Umbraco 8.
Here is the code i've got so far,
Would be great if anyone has any ideas on what i'm doing wrong.
Im not a developer so apologies if this is a silly question!
Thanks!
Hi Andy,
Welcome to the forum! There are no silly questions here. :-)
Try it the same way as how you got the first lot of items, like so...
It's because the Razor template is expecting a certain object type, so it knows how to loop over it. In your original snippet, when you call
.Value()
, Razor doesn't know that it can be looped over, so it throws an error.Hopefully this should work for you.
Cheers,
- Lee
Hi Lee,
Thanks for the quick reply. That works perfectly! It seems so obvious now.
Thanks for your help!
It's all a journey, one step at a time.
Happy to hear that it worked!
Cheers,
- Lee
is working on a reply...