Copied to clipboard

Flag this post as spam?

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

  • ddjak 5 posts 95 karma points
    Dec 03, 2018 @ 15:09

    Can't show image in Nested Content

    Hello everyone,

    New to Umbraco and I started using Nested Content. It's really convenient!

    I am able to render strings, but not images from the content/doc types. It shows the value as null even though I've put an image in the BackOffice. Would love if there is something obvious I'm missing.

    Here's the code:

    @inherits UmbracoTemplatePage
        IEnumerable<IPublishedContent> items = Umbraco.AssignedContentItem.GetPropertyValue<IEnumerable<IPublishedContent>>("showProducts");
        foreach (var item in items)
            string title = item.GetPropertyValue<string>("productName");
            string price = item.GetPropertyValue<string>("price");
            var photo = item.GetPropertyValue<IPublishedContent>("photos");
            //<div style="background-image:url('@(photos)');"></div>
            //<img src="@(Umbraco.AssignedContentItem.GetPropertyValue<IPublishedContent>("photos").Url)" />
            <img src="@photo.Url" height="200" width="200" alt="@item.Name"/>

    I've tried a few other ways to no avail. I feel I'm missing something in terms of the connection to the images uploaded in nested content for the specific current page.

  • Dave Woestenborghs 3189 posts 10602 karma points MVP 3x admin c-trib
    Dec 03, 2018 @ 15:20
    Dave Woestenborghs

    Hi ddjak,

    What do you get when you output @photo.Name ?

    And is the "photos" the correct property type alias. And what picker are you using ?


  • ddjak 5 posts 95 karma points
    Dec 03, 2018 @ 15:46

    I fixed it!

    Turns out it had everything to do with the Media Picker. I disabled multiple image uploads and it worked like a charm!


Please Sign in or register to post replies

Write your reply to: