Copied to clipboard

Flag this post as spam?

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


  • Andreas Johansson 9 posts 42 karma points
    Nov 09, 2012 @ 14:37
    Andreas Johansson
    0

    How to iterate a "Related Links" using C#

    Hi!

    I'm having trouble using the umbraco default datatype "related links". My problem is that I want to iterate the property's children/options. I've seen examples using xml and xslt but I'm wondering if there's any possibilty to use pure c# inside a User Control.

    Something like this (But a working variant)

     

    Node node = new Node(Node.getCurrentNodeId());
    var linklist = node.GetProperty("link");
    if (node.GetProperty("link") != null)
    {
    foreach (var item in linklist)

    //get each item here
    }
    }

    Thanks!

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Nov 11, 2012 @ 12:10
    Jeroen Breuer
    0

    Do you have some code on how to do this in Razor? You can also use that code in a UserControl. Have a look here: http://our.umbraco.org/forum/developers/razor/27417-Use-Razor-code-in-UserControl?p=1#comment102639

    Jeroen

  • Andreas Johansson 9 posts 42 karma points
    Nov 12, 2012 @ 09:49
  • 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