Copied to clipboard

Flag this post as spam?

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


  • Steve 140 posts 321 karma points
    Jun 12, 2014 @ 03:40
    Steve
    0

    Media Picker in Overview template U7 Razor

    Hi,

    I have an Overview template which summarizes properties from child pages (text, Vorto fields, etc.) but I cannot figure out how to access the contents of the Media Picker property of the child pages.

    I iterate through the child pages with a @foreach (IPublishedContent item in newsItems) { ...} loop (I believe getting the Vorto values requires the cast to IPublishedContent)

    I have tried an adaptation of the solution here:

    http://our.umbraco.org/forum/developers/razor/46969-Displaying-Images-from-Multiple-Media-Picker

    but no luck

    Any help would be much appreciated!

    Thanks,

    Steve

  • Steve 140 posts 321 karma points
    Jun 12, 2014 @ 04:51
    Steve
    0

    Hi again,

    Found a solution:

     @foreach (IPublishedContent item in newsItems) {

    var im = Umbraco.TypedMedia(item.GetProperty("featureImage").DataValue);

    <img src="im.Url"/>

    }

    ... but found this quite tricky. Where could I find good reference material on such things?

    Thanks,

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft