Copied to clipboard

Flag this post as spam?

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


  • dan 54 posts 133 karma points
    May 18, 2018 @ 19:42
    dan
    0

    TypeMedia MediaPicker no children

    I have this gallery that worked in a previously and since upgrading I'm not seeing any children returned when I use the TypeMedia(media picker id).

    It's been a few years since I looked at this so I'm wondering if I something became obsolete?

    When I loop through mediaObj.Children its null but I can see that I'm passing in the media picker id into TypeMedia.

    var mediaPicker = Umbraco.Media(CurrentPage.mediaPhotos);
    var mediaObj = Umbraco.TypedMedia(mediaPicker.Id);
    
    
            foreach (var v in mediaObj.Children)
            {
    
    
            }
    
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    May 19, 2018 @ 07:00
    Dennis Aaen
    0

    Hi Dan

    Have a look here https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker2

    There are also some code examples

    Hope this helps

    /Dennis

  • dan 54 posts 133 karma points
    May 22, 2018 @ 18:55
    dan
    0

    Thanks Dennis,

    That solution does work but I'm not looking to select one item or a group. I'm trying to select the entire folder which isn't explained there.

    I had this working once before but apparently its not returning anything.

  • dan 54 posts 133 karma points
    May 24, 2018 @ 02:43
    dan
    0

    Thanks for replying anyway Dennis. I figured out this is all I needed to do to select a folder and access its children. Its very similar except how I'm getting the media picker.

    var photoFolder = Model.Content.GetPropertyValue("photos").ToString();
    
    foreach (var m in Umbraco.TypedMedia(photoFolder).Children)
        {
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft