Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Feb 15, 2019 @ 12:48
    mikkel
    0

    how do i make a variabel for a parent and child in one variabel

    Hi i am a litle bit lost here. How can I make a variable that hits 2 different document types that I can then use in one foreach loop ?? I simply can't figure it out :)

    I have try to hit the parent first and then the child of that parent but it dont work

    here is my code

    var selection = Model.Content.Site().Parent<ServiceYdelser>().Children<ServiceYdelse>();
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 15, 2019 @ 13:57
    Alex Skrypnyk
    0

    Hi Mikkel

    Do you need a list of all "ServiceYdelser" nodes?

    Alex

  • mikkel 143 posts 365 karma points
    Feb 15, 2019 @ 15:24
    mikkel
    0

    Hi Alex Yep i need Them all😃 there are only 3

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 15, 2019 @ 14:07
    Dirk De Grave
    0

    Hi,

    Model.Content.Site() 
    

    returns top most level node in the tree, so not sure why you're adding

    .Parent<T>() 
    

    before getting the child nodes?

    Assuming you'd want

    Model.Content.Site().FirstChild<T>().Children<TT>()
    
Please Sign in or register to post replies

Write your reply to:

Draft