Copied to clipboard

Flag this post as spam?

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


  • Rocoeh 65 posts 86 karma points
    Jun 22, 2012 @ 17:07
    Rocoeh
    0

    Redering an image with razor

     Hi,

    I have returned a url with a razor loop, I want to render this out, how do I do it....my code below.

    <umbraco:Macro runat="server" language="cshtml">
                        
                        @{
       var faq = Library.NodeById(1555);

       foreach(var item in faq.Children)
       {
      
       @item.umbracoFile;  // this gives the url
       <img src="@item.umbrocoFile" /> // this does not render the image.
       }
     }

    </umbraco:Macro>

  • Douglas Ludlow 210 posts 366 karma points
    Jun 22, 2012 @ 17:11
    Douglas Ludlow
    0

    What is node 1555? Is it a document or a media item? Also, just guessing it's a typo, but in the image tag you're using umbrocoFile instead of umbracoFile.

  • Dmitriy Skudnov 39 posts 64 karma points
    Jun 22, 2012 @ 17:12
    Dmitriy Skudnov
    0

    You have misspell  "@item.umbrocoFile"   change to @item.umbracoFile


  • Rocoeh 65 posts 86 karma points
    Jun 22, 2012 @ 17:43
    Rocoeh
    0

    sorry...long day

  • 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