Copied to clipboard

Flag this post as spam?

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


  • TikTakToe 60 posts 102 karma points
    Mar 21, 2015 @ 21:28
    TikTakToe
    0

    Imulus.UrlPicker Url always null for Media

    This has been driving me nuts all day!

    I have a 'feature box' archetype which has a title, desc, and url picker - works fine when I pick content, i.e. i can retrieve the url property from the picker, however, when I choose media, the url is always null.

    btw, I'm using this in the context of the hybrid framework.

    Any pointer appreciated - I have tried deleting my indexes etc as i'm aware of issue with umbraco.typedmedia and corrupted indexes but still no joy

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 23, 2015 @ 12:08
    Jeroen Breuer
    0

    Hello,

    Do you have some code you can share so we can see what might be the problem? If you just use Umbraco.TypedMedia(id) you do get the media back?

    Jeroen

  • TikTakToe 60 posts 102 karma points
    Mar 23, 2015 @ 12:29
    TikTakToe
    0

    hi

    Thanks, I'm using the code below to get the data from the widget - it works for type=content (looking at the json I can see the fields populated correctly) but when I choose media, the url is always null. I thought it might be my indexes, so I reset iis and cleared the temp folder and rebuilt but no joy - I'll check the TypedMedia()

        private IEnumerable<RelatedItem> GetRelatedImages()
        {
    
            //get user selected related images        
            var archetypeModel = CurrentPage.GetPropertyValue<ArchetypeModel>("relatedPhotos");
            if (archetypeModel == null || !archetypeModel.Fieldsets.Any()) return null;
    
            return archetypeModel.Select(x => new RelatedItem()
            {
                Title = x.GetValue<string>("title"),
                Description = x.GetValue<string>("description"),
                Image = x.GetValue<Image>("image"),
                Url = x.GetValue<UrlPicker.Umbraco.Models.UrlPicker>("link").Url
            }).ToList();
    
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft