Copied to clipboard

Flag this post as spam?

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


  • Boris 9 posts 49 karma points
    Jul 01, 2015 @ 05:47
    Boris
    0

    How to render child content item directly in the parent.

    Hi,

    in my view, I am looping through the children of a content item. This item is from type DynamicPublishedContent.

    How can I directly render this child item in the current template? There is an associated template with the Document type and I just want to render it.

    foreach (var rightItem in rightContainer.Children)
    {
        @rightItem
        <br/>
    }
    

    Regards, Boris

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Jul 01, 2015 @ 07:48
    Kevin Jump
    1

    Hi,

    In order to render the child items inside the parent, you can use partial views (as technically you are only rendering a part of the page.

    The example for partial views in the documentation actually shows how to render child items and is probably what you are looking for.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jul 01, 2015 @ 07:52
    David Brendel
    100

    Hi Boris,

    as an alternative if you want to use the template if the Childs have a look at the RenderTemplate-method of the umbraco helper. This should render the template directly.

    Regards David

  • Boris 9 posts 49 karma points
    Jul 01, 2015 @ 07:58
    Boris
    0

    That sounds nice, David

    Thanks, Boris

Please Sign in or register to post replies

Write your reply to:

Draft