Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Jul 25, 2017 @ 05:37
    k
    0

    mediapicker issue on 7.6.3

    Hello,

    I am using the below code from the documentation page :

    https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/media-picker

    @{
    var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("caseStudyImages");
    foreach (var item in typedMultiMediaPicker)
    {
        <img src="@item.Url" style="width:200px"/>
    }
    

    }

    But I am not able to get the children in typedMultiMediaPicker.

    When I do foreach (var item in typedMultiMediaPicker.Children) , I get error.

    But @typedMultiMediaPicker.Id does give me the id of my media folder.

    can someone please help.

    Thanks,

    kusum

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Jul 25, 2017 @ 07:21
    Alex Skrypnyk
    1

    Hi Kusum

    If "typedMultiMediaPicker" is a media folder, then you have to use code like that:

    var typedMultiMediaPicker = Model.Content.GetPropertyValue<IPublishedContent>("caseStudyImages");
    foreach (var item in typedMultiMediaPicker.Children)
    {
        <img src="@item.Url" style="width:200px" />
    }
    

    Thanks,

    Alex

  • k 256 posts 654 karma points
    Jul 26, 2017 @ 12:08
    k
    0

    thanks alex

  • 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