Im trying to list my items in groups of 3, however, I cant get InGroupsOf() to work - If I remove Take() and InGroupsOf, then it loops, but when i have Take and InGroupsOf, then I get an error:
@inherits umbraco.MacroEngines.DynamicNodeContext
@if (Model.Children.Where("Visible").Any())
{
<div class="chapter-block">
@{
var count = @Model.Children.Count();
}
@foreach (var childPage in Model.Children.Where("Visible").Take(count).InGroupsOf(3))
InGroupsOf doesn't work?
Im trying to list my items in groups of 3, however, I cant get InGroupsOf() to work - If I remove Take() and InGroupsOf, then it loops, but when i have Take and InGroupsOf, then I get an error:
@inherits umbraco.MacroEngines.DynamicNodeContext
@if (Model.Children.Where("Visible").Any())
{
<div class="chapter-block">
@{
var count = @Model.Children.Count();
}
@foreach (var childPage in Model.Children.Where("Visible").Take(count).InGroupsOf(3))
{
var child = childPage.Children.FirstOrDefault();
if (child != null)
{
var url = child.Url;
<a href="@url">
@childPage.chapterHeading
</a>
}
}
</div>
}
Hi Nicky,
Maybe this small example from Sebastiaan Janssen can help you find a solution.
https://gist.github.com/nul800sebastiaan/1067257
/Dennis
Ahhh, great, thx :)
is working on a reply...