@model IEnumerable<IPublishedContent>
@if (Model.Any())
{
<div>
@* List each piece of nested content *@
<ul>
@{
var i = 0;
foreach (var node in Model)
{
i++;
<li>@i</li>
@* you can get your properties here too *@
}
}
</ul>
</div>
<div>
@* Render the Grid on each piece of Content *@
@{
var c = 0;
foreach (var node in Model)
{
c++;
@Html.GetGridHtml(node.GetProperty("contentGrid"))
}
}
</div>
}
However, you could probably just do (untested)
@{
var nestedContent = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("contentTabs");
foreach (var item in nestedContent)
{
@Html.GetGridHtml(item.GetProperty("contentGrid"));
}
}
How To Render Grid Layout in Nested Content
Hi,
I'm trying to render my grid which is located inside the nested content (see image below)
I usually use the code below to render my text from the nested content, but it's not working with the grid.
I also tried a few other codes that I could think of but nothing seems to be working.
Thanks in advance for you help.
I am doing the following:
View
@Html.Partial("Components/ContentTabs", Model.ContentTabs)
Partial
However, you could probably just do (untested)
Hi Laurence,
I tried your untested snippet, and it worked beautifully.
Thanks for helping with this.
is working on a reply...