Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Eduardo Rivas 17 posts 37 karma points
    Feb 19, 2012 @ 23:00
    Eduardo Rivas
    0

    Umbraco 5: Assign class to even/odd children

    I would like to assign a css class to a div depending on if it is an even or odd child. This is what I have:

      @foreach (var item in DynamicModel.Children)
      {
          <div class="@item.Position().IsEven("even_class","odd_class")>
          stuff
          </div>
      }

    I'm very new to Razor, so I guess the expression is wrong because I get this error:

    Could not finding matching Signature for 'Position' with 0 parameters.

    Any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft