Copied to clipboard

Flag this post as spam?

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


  • Fredrik Esseen 610 posts 906 karma points
    Nov 28, 2012 @ 18:18
    Fredrik Esseen
    0

    Get node by ID

    Just a simple thing in my 4.11 mvc installation.

    I want to to get a nodes children by specifying the parent node's id.

    Im trying this:

    @{ var menuItems = Model.Content.NodeById(1119).Children.Where(x => x.IsVisible() && x.IsDocumentType("MenuItem") && x.TemplateId > 0 && Umbraco.MemberHasAccess(x.Id, x.Path)); }

     

    But this obviously isnt right. What is the way to do it and are there any good documentations somewhere so I know what possibilities I have?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Nov 28, 2012 @ 19:04
    Jeroen Breuer
    0

    The Umbraco Helper has some useful methods: http://our.umbraco.org/documentation/Reference/Mvc/views

    I think you need TypedContent or Content on the helper.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft