Copied to clipboard

Flag this post as spam?

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


  • jools 15 posts 79 karma points
    Jan 24, 2018 @ 17:05
    jools
    0

    Display number of Children under a specific Node ID

    Hi

    I am trying to display the number of Children within a specific Node ID.

    I know the ID and that there are current 6 child documents under this specific node.

    So i just want to display the number 6 as there are 6 children.

    Im still an absolute newbie to Umbraco especially writing any razor code so if any help much appreaciated

    Thanks

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jan 24, 2018 @ 17:06
    Alex Skrypnyk
    0

    hi Jools

    Please, show your Razir code - I will provide a fix

    /Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jan 24, 2018 @ 17:22
    Alex Skrypnyk
    0

    This code should work with Umbraco 7:

    var node = Umbraco.TypedContent(nodeId);
    
    var childAmount = node.Children.Count();
    
    @childAmount
    
  • jools 15 posts 79 karma points
    Jan 29, 2018 @ 09:03
    jools
    0

    This works great Alex! :)

    Just wondering also, is there a way of using the nodeName instead of the nodeID?

  • jools 15 posts 79 karma points
    Jan 24, 2018 @ 17:46
    jools
    0

    Thanks Alex for a quick response! I will give that a try when I’m back in tomorrow.

Please Sign in or register to post replies

Write your reply to:

Draft