Skip to content

Instantly share code, notes, and snippets.

@nul800sebastiaan
Created July 6, 2011 13:47
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nul800sebastiaan/1067257 to your computer and use it in GitHub Desktop.
Save nul800sebastiaan/1067257 to your computer and use it in GitHub Desktop.
Grouping in Razor (Umbraco 4.7.1)
@foreach(var group in Model.Children.InGroupsOf(2))
{
<div class="row-of-two">
@foreach(var item in group)
{
<span>@item.Name</span>
}
</div>
}
@nul800sebastiaan
Copy link
Author

Produces something like:

<div class="row-of-two">
  <span>Title 1</span>
  <span>Title 2</span>
</div>

<div class="row-of-two">
  <span>Title 3</span>
  <span>Title 4</span>
</div>

..etc. :)

@windel12
Copy link

windel12 commented Mar 3, 2015

It's awesome, man!

@sumeshkp18
Copy link

This is superb #h5yr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment