Copied to clipboard

Flag this post as spam?

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


  • Jonas Wideking 2 posts 72 karma points
    Jan 19, 2016 @ 15:25
    Jonas Wideking
    0

    Get names from multinode treepicker

    I have a multinode treepicker with the alias "tags". I want to get the actual names of the picks and extend them to the URL archiveLink, so that I ideally end up with something like: http://url.com/#filters=filter1,filter2,filter3

    var archiveLink = Umbraco.NiceUrl(3382);
    
    if (CurrentPage.HasValue("tags")) {
        IEnumerable<IPublishedContent> allTags = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("tags");
    
        archiveLink += "#filters=";
    
        foreach (var tag in allTags) {
            archiveLink += tag.Name<text>,</text>;
        }
    }
    

    I get this error: Object reference not set to an instance of an object. And I honestly have no clue what to do.. Yelp. :')

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 19, 2016 @ 16:03
    Dennis Aaen
    0

    Hi Jonas and welcome to our :-)

    Try to see the documentation for the Multinode Treepicker on how to get data out using Razor https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Multinode-Treepicker

    In the documentation you will find examples on how to get data from the multinode treepicker in Razor. You will find Razor examples for in dynamic Razor and strongly typed Razor

    Hope this helps,

    /Dennis

  • Jonas Wideking 2 posts 72 karma points
    Jan 22, 2016 @ 12:43
    Jonas Wideking
    0

    Oh damn, thank you so much Dennis. Managed to mingle some stuff together from that one.

    God dag!

Please Sign in or register to post replies

Write your reply to:

Draft