Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Im looking for some help with my razor. I'm trying to split an unknown number of items into two groups.
Id like to find the number of item in items and split them evenly.
Any help would be grateful.
martin
@inherits Umbraco.Web.Mvc.UmbracoViewPage @if (Model.HasValue("SmartBulletsList")){ var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("SmartBulletsList"); if(items.Any()) { <div> <div class="row"> @foreach(var group in items.InGroupsOf(2)) { <div class="six"> <ul class=""> @foreach(var item in group) { <li> @item.GetPropertyValue("bulletItem") </li> } </ul> </div> } </div> </div> } }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
InGroupsOf - Split Number of Items
Hi,
Im looking for some help with my razor. I'm trying to split an unknown number of items into two groups.
Id like to find the number of item in items and split them evenly.
Any help would be grateful.
martin
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.