Copied to clipboard

Flag this post as spam?

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


  • Pete 213 posts 285 karma points
    Mar 13, 2013 @ 16:32
    Pete
    0

    DAMP doesn't work in foreach loop

    umbraco v 4.11.4 (Assembly version: 1.0.4780.19111)

    Digibiz Advanced Media Picker version 2.0

    This works:
    @{
     dynamic file = Model.Descendants("Listing").First().downloadLink.mediaItem.File;
     <a href="@file.umbracoFile">DOWNLOAD</a>
    }


    This does not:
    foreach(var itemx in Model.Descendants("Listing"))
                {
                    dynamic file = itemx.dampFile.downloadLink.File;
                    <p>@file.umbracoFile</p>
                }
    Help!
    Thanks
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 13, 2013 @ 16:36
    Jeroen Breuer
    100

    What error do you get? It might be easier to use the DAMP Razor Model (use the version for "old" Razor) for this.

    You could also have a look at the DAMP samples package. It also has a foreach. You can see the source here.

    Jeroen

  • Pete 213 posts 285 karma points
    Mar 16, 2013 @ 16:12
    Pete
    0

    Thanks Jeroen

    I used  @itemx.downloadLink.First.File  in the end instead of  itemx.dampFile.downloadLink.File

    Cheers, Pete

Please Sign in or register to post replies

Write your reply to:

Draft