Copied to clipboard

Flag this post as spam?

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


  • Mike Taylor 155 posts 353 karma points
    Jan 14, 2012 @ 11:42
    Mike Taylor
    0

    Using uComponents Multi-URL Picker with Razor and a Macro Parameter

    I can iterate through a Multi-URL Picker when the field is hard coded like this:

    <ul>
    @foreach (var link in Model.mainContentLinks.urlpicker)
    {
        <li><a href="@link.url"@Html.Raw(link.newwindow == "True" ? "target=\"_blank\"" : "")>@link.linktitle</a></li>
    }
    </ul>

     

    But, I'm passing the Multi-URL Picker field as a propertyTypeAlias macro parameter (called "linkField"), and I'm struggling to get it to work.

    I've tried:

    @foreach (var link in Model.GetProperty(Parameter.linkField).urlpicker)

    or

    @foreach (var link in Library.ToDynamicXml(Model.GetProperty(Parameter.linkField)).urlpicker)

     

    What am I missing?

    Cheers,

    Mike

  • Mike Taylor 155 posts 353 karma points
    Jan 14, 2012 @ 11:56
    Mike Taylor
    0

    Also tried Library.ToDynamicXml(Model.GetProperty(Parameter.linkField).Value).urlpicker - still no joy...

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Jan 14, 2012 @ 12:09
    Jeroen Breuer
    0

    Could it be related to this old issue: http://ucomponents.codeplex.com/workitem/13465.

    Guess you're trying to do the same things as in here: http://our.umbraco.org/forum/developers/razor/19984-Razor-variable-property#comment75914.

    Jeroen

     

  • Mike Taylor 155 posts 353 karma points
    Jan 14, 2012 @ 12:36
    Mike Taylor
    0

    Yeah, that's where I started, but couldn't get it to work.

    In the end I gave up, and used the "Related Links with Media" data type instead, which seems to work fine.

    M

  • 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