Copied to clipboard

Flag this post as spam?

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


  • Paul 18 posts 159 karma points
    Nov 09, 2017 @ 11:39
    Paul
    0

    RJP.MultiUrlPicker - no luck, seems to be empty

    Reasonably new to Umbraco, so I'd appreciate any help with this.

    Using RJP.MultiUrlPicker I've hit some big bumps in migrating my platform to Razor views.

    My code is:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using RJP.MultiUrlPicker.Models
    
    @{
        var multiUrlPicker = Model.Content.GetPropertyValue<dynamic>("link");
    }
    
    
    <p>@multiUrlPicker</p>
    
    @if (Enumerable.Any(multiUrlPicker))
    {
        <ul>
            @foreach(var link in multiUrlPicker)
            {
                <li><a href="">@link.Name</a></li>
            }
        </ul>
    } else {
        <p>Null</p>
    }
    

    On the page this is templating out:

    System.Linq.Enumerable+

    Null

    It's just a single multiurl. I don't quite understand why this isn't working when I'm using the same code I've found everywhere which seems to work for everyone else.

    Someone fundamental I'm missing?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 09, 2017 @ 11:51
    Jeavon Leopold
    100

    You need to specify the return type, I think it should be:

    var multiUrlPicker = Model.Content.GetPropertyValue<IEnumerable<Link>>("link");
    
  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Nov 09, 2017 @ 13:47
    Alex Skrypnyk
    1

    Hi Guys

    What is a benefit of using MultiUrlPicker? I think related links datatype provides the same functionality and is in the core.

    THanks,

    Alex

  • Paul 18 posts 159 karma points
    Nov 09, 2017 @ 14:56
    Paul
    0

    Thanks Jeavon, that's brilliant. It worked. Flagged as solved. Appreciate your help.

    Alex, I want to migrate this without changing the datatype as I'm presuming this would require content work to repick the links across the website?

    If I'm wrong let me know as I'm only trying to limit the work needed to get this out (I'd probably update the datatype at a later date).

    All best, Paul

Please Sign in or register to post replies

Write your reply to:

Draft