Copied to clipboard

Flag this post as spam?

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


  • Tim Gerhard 10 posts 125 karma points
    Sep 07, 2017 @ 12:25
    Tim Gerhard
    0

    Umbraco 7.6.6 Related links vorto problem

    Hey Guys I have a problem with reading out my related links list. I tried debuging it and i found out that itemSelection (the array) is empty.

    This is my code:

      int worldOfWorkNodeId = 1138;
        var worldOfWorkNode = Umbraco.TypedContent(worldOfWorkNodeId);
    
    
    
     @{var itemSelection = worldOfWorkNode.GetVortoValue<JArray>("linklist");}
    
                                                    @if (itemSelection != null)
                                                    {
                                                        foreach (var linkitem in itemSelection)
                                                        {
                                                            var linkUrl = (linkitem.Value<bool>("isInternal")) ? Umbraco.NiceUrl(linkitem.Value<int>("internal")) : linkitem.Value<string>("link");
                                                            var linkTarget = linkitem.Value<bool>("newWindow") ? "_blank" : null;
                                                            <li><a onclick="scrollToElem()" href="@linkUrl">@(linkitem.Value<string>("caption"))</a></li>
                                                        }
                                                    } 
    

    Thanks in advance, Tim

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Sep 07, 2017 @ 14:26
    Alex Skrypnyk
    0

    Hi Tim, are you using latest Umbraco version?

    Can you show all razor code?

    Thanks,

    Alex

  • Tim Gerhard 10 posts 125 karma points
    Sep 08, 2017 @ 05:53
    Tim Gerhard
    0

    I am using 7.6.6 And i posted all the code that I have to read out the related link list

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Sep 11, 2017 @ 10:15
    Alex Skrypnyk
    0

    Hi Tim

    Did you solve the issue?

    Thanks,

    Alex

  • Tim Gerhard 10 posts 125 karma points
    Sep 12, 2017 @ 06:04
    Tim Gerhard
    0

    I decided to try a different way of solving my problem. I know that it works with propertyValue but i haven't found a way yet to get the contents out of a Vorto Relatedlink list.

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Sep 08, 2017 @ 12:44
    Alex Skrypnyk
    0

    Hi Tim

    What about Property Value Converters is it enabled in your solution?

    Try this code:

    worldOfWorkNode.GetValue<JArray>("linklist");
    

    Is it working without Vorto Helper?

    In latest Umbraco this code should work:

    var itemSelection = worldOfWorkNode.GetPropertyValue<RelatedLinks>("linklist");
    

    Read more: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Related-Links2

    Thanks,

    Alex

  • Ammar 3 posts 23 karma points
    Dec 10, 2017 @ 11:14
    Ammar
    0

    Try this ,

    @foreach (var a in ((Newtonsoft.Json.Linq.JArray)item.GetVortoValue("importantLinks")))

    I was able to get values by doing this.

Please Sign in or register to post replies

Write your reply to:

Draft