Copied to clipboard

Flag this post as spam?

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


  • Brian 7 posts 27 karma points
    Mar 06, 2013 @ 18:45
    Brian
    0

    Display image chosen from MediaPicker v6 razor partial

    Hi

    I'm trying to display an image chosen with the media picker datatype in a partial razor view:

    @{
        var heroItems = CurrentPage.HeroItems;
    }
    
    @foreach (var item in heroItems)
    {
        <img src="@Umbraco.Media(item.HeroImage.Id).Url" alt="image description" width="980" height="333" />
    }

     

    My "item" dynamic does not come back with a property for "HeroImage". Other properties of different datatypes (Richtext, textstring) are coming back fine.

    I've tried clearing the cache.

    Any ideas what I could be doing wrong?

  • Brian 7 posts 27 karma points
    Mar 07, 2013 @ 11:36
    Brian
    0

    I've got it working now - I was clearly getting a cached version back somehow which is odd because I cleared it down in the back office, and have disabled the cache in the umbraco config.

    Also my razor syntax was incorrect, it should be:

    @Umbraco.Media(item.HeroImage.ToString()).Url

     

Please Sign in or register to post replies

Write your reply to:

Draft