Copied to clipboard

Flag this post as spam?

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


  • Simeon Ostberg 123 posts 389 karma points
    Aug 16, 2022 @ 08:42
    Simeon Ostberg
    0

    Get node's index number

    Hi everyone,

    I'm looking for a way to get the node's index number. Here's what I'm looking for, for example:

    - Node
    -- Subnode 1
    -- Subnode 2
    

    Now I want to use the node index in the partial view, means: "1" for Subnode 1 and "2" for Subnode 2. How would I do this? I didn't find anything by searching (or used the wrong key words).

    Thank you! Simeon

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Aug 16, 2022 @ 15:28
    Huw Reddick
    100

    Nodes have a SortOrder property (it is set when ordering the nodes in the back office)

    var updates = Model.ChildrenOfType("technicalUpdate").Where(x => x.IsVisible()).OrderBy(x => x.SortOrder);
    

    that is from v8 but should be something similar in v7

  • Simeon Ostberg 123 posts 389 karma points
    Aug 16, 2022 @ 15:58
    Simeon Ostberg
    0

    Hi Huw,

    Thank you! SortOrder was what I was looking for. Although I don't want to order. I just want to follow, in which node a button is clicked.

    Regards, Simeon

  • 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