Copied to clipboard

Flag this post as spam?

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


  • NiQ 24 posts 45 karma points
    Nov 11, 2011 @ 14:03
    NiQ
    0

    Create array from Embedded Content?

    Usually I have this:

    foreach (dynamic item in Model.images)
    {
    <img src="@Model.MediaById(item.image).umbracoFile" alt="" />
    }

    But this time I always have two items in the control so I want to create an array instead of a foreach loop.

    How do I create an array of the Mode.images and get the [0] and [1] item?

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Nov 17, 2011 @ 20:04
    Sebastiaan Janssen
    0

    Instead, why not try: @Model.images.First() or @Model.images.Take(1) and Model.images.Skip(1).Take(1)

  • 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.

Please Sign in or register to post replies