Copied to clipboard

Flag this post as spam?

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


  • Kim Andersen 1447 posts 2197 karma points MVP
    Jan 29, 2012 @ 22:19
    Kim Andersen
    0

    v5: How to loop over children on a selected node in a content picker

    Hi guys

    Let's say I have a list of nodes on a doument type of mine. This list just renders the cildren of the current node using:

    foreach (var node in DynamicModel.Children)

    This is pretty simple.

    But on the same document type, I've got a content picker(with an alias of sourceTree). If there's selected a node in this content picker I want to list all children of the selected node. I can't make this work, but I guess I have to do some stuff like the following:

    @{
    dynamic startNode = DynamicModel;

    if(DynamicModel.SourceTree != ""){ //Is this the best way of making sure that a node is selected in the content picker?
    startNode = //What to do here?
    }
    foreach (var node in startNode.Children){
    //I'll do some stuff here. No problems inside the loop.
    }
    }

    Anyone have some inputs to this?

    Thanks in advance :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft