Copied to clipboard

Flag this post as spam?

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


  • Vanilson 7 posts 97 karma points
    May 05, 2018 @ 16:46
    Vanilson
    0

    Relation Types Umbraco

    Hi Devs, I´m trying to implement relations between nodes using Umbraco Relation Editor, in the backoffice I can see the relation that I have created, but I'm having problems when I try to get the values.

    Code

    @foreach (var item in Model.Content.Related<IPublishedContent>("relationType"))
    {
         <p> @item .Name </p>
    }
    

    When I run the project it doesn't show me any values.

    I´m using Umbraco 7.2.1 and Umbraco Relation Editor 1.1.5550

    Best regards

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 07, 2018 @ 09:35
    Dave Woestenborghs
    0

    Hi,

    Is "relationType" the actual name of your relation type ?

    You can go in to developer section and find the relation types tree. You need to pass in the exact alias of the relation type :

    enter image description here

    Dave

  • Vanilson 7 posts 97 karma points
    May 08, 2018 @ 06:51
    Vanilson
    0

    Hi Dave,

    Is "relationType" the actual name of your relation type ?

    Yes, it is Dave. The only thing different in my relation is that the Direction value is Bidirectional.

    Best Regards

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 08, 2018 @ 06:56
    Dave Woestenborghs
    0

    Does it work when you change it to Parent to child ?

    If that works you should create a issue here : https://github.com/lars-erik/umbraco-relation-editor

    dave

  • Vanilson 7 posts 97 karma points
    May 08, 2018 @ 09:47
    Vanilson
    0

    Hi Dave,

    Does it work when you change it to Parent to child ?

    Nope, still returning nothing.

    I try to test this line

    var relatedBlogposts = Model.Content.Related

    and is returning

    System.Linq.Enumerable+OfTypeIterator>d__93`1[Umbraco.Core.Models.IPublishedContent]

    Best regards

  • Jonny Flanagan 34 posts 163 karma points
    Dec 04, 2018 @ 14:52
    Jonny Flanagan
    0

    Hi Vanilson,

    I have a similar issue with no results. Did you make any progress with this?

    I hope to use the Relation API to relate content items e.g. the annual report of 2018 is related to the annual report of 2017 and vice versa

    Thanks Jonny

Please Sign in or register to post replies

Write your reply to:

Draft