I am using nested content and it works fine when I use the below :
var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("myPropertyAlias");
foreach(var item in items)
{
// Render your content, e.g. item.GetPropertyValue<string>("heading")
}
However when I try to get the values of a child node as below :
foreach(var cat in CurrentPage.Children.Where("Visible"))
{
var items = cat.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("director");
foreach(var item in items)
{
<h3>@item.GetPropertyValue("test")</h3>
}
}
I get nothing from "cat"
Can someone please help me with the right syntax ? Please help me find what I am doing wrong.
Nested content
Hello,
I am using nested content and it works fine when I use the below :
However when I try to get the values of a child node as below :
I get nothing from "cat"
Can someone please help me with the right syntax ? Please help me find what I am doing wrong.
Thanks,
Kusum
Hi
Use this code:
Hi K
Did you solve the issue? Share with us, please.
Thanks,
Alex
Hello Alex,
Sorry for late reply.
I have used the above code but I am getting the below error ;
Hmmm.. you shouldn't need to null check but does this work?`
Hi steven,
Thanks a lot. Code working perfectly well. :)
k
is working on a reply...