Copied to clipboard

Flag this post as spam?

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


  • Arno L. Kristiansen 43 posts 63 karma points
    Jan 25, 2012 @ 14:11
    Arno L. Kristiansen
    0

    How do I get URL out of a Children Node

    I have made this C# code :

       umbraco.presentation.nodeFactory.Node node = new umbraco.presentation.nodeFactory.Node(2930);

                umbraco.presentation.nodeFactory.Nodes childrenNodes = node.Children;                       

                Repeater1.DataSource = childrenNodes;
    Repeater1.DataBind();

    Show it with this code:

    <ItemTemplate><li><a href="<%# Eval("NiceUrl") %>"> <%# Eval("Name") %> </a>   

        </li></ItemTemplate>

    My problem is that I get the NiceUrl of the current pages not from the childrenNodes..

    How do I get the URL for the Children node ?? 

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jan 25, 2012 @ 14:14
    Jeroen Breuer
    0

    You could try umbraco.library.NiceUrl(id) in your frontend code. Maybe this wiki can also help: http://our.umbraco.org/wiki/reference/code-snippets/databind-node-children

    Jeroen

  • Arno L. Kristiansen 43 posts 63 karma points
    Jan 25, 2012 @ 14:21
    Arno L. Kristiansen
    0

    Shell it look like this ??

     

       <ItemTemplate><li><a href="<%# Eval(umbraco.library.NiceUrl("id")) %>"> <%# Eval("Name") %> </a>   

        </li></ItemTemplate>

    this I tried with out any look !! 

    also this

     <ItemTemplate><li><a href="<%# Eval("umbraco.library.NiceUrl(id)") %>"> <%# Eval("Name") %> </a>

            </li></ItemTemplate>

    without any look..

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jan 25, 2012 @ 14:24
    Jeroen Breuer
    0

    Hmm I'm no expert at using Eval. Try this:

    <ItemTemplate><li><a href="<%# umbraco.library.NiceUrl(Convert.ToInt32(Eval("Id"))) %>"> <%# Eval("Name") %> </a>

    Jeroen

  • Arno L. Kristiansen 43 posts 63 karma points
    Jan 25, 2012 @ 14:28
    Arno L. Kristiansen
    0

    SUPER !! this works perfect... thx a lot...

    Can I ask you another question ?? Do you know where I can se the format of ex. Node or Children ? 

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jan 25, 2012 @ 14:29
    Jeroen Breuer
    0

    Sorry I don't understand your question. What do you want to do with the Node or Children?

    Jeroen

  • Arno L. Kristiansen 43 posts 63 karma points
    Jan 25, 2012 @ 14:42
    Arno L. Kristiansen
    0

    I see if I can explain it a bit bether ;-)

    Sometimes it could be nice if there was some documentation that explain what values I'm able to find in a Node class or in a children class..

    I can offcouse see it in my VS ... but do you know if there exists a pages on the Umbraco site that explain this ??

    /arno

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jan 25, 2012 @ 14:48
    Jeroen Breuer
    0

    Well the Node and DynamicNode class are different for each node off course. They contain the same default properties, but the values are different. You can have a look at how your data is stored in App_Data/umbraco.config. That's how most data can also be used with the DynamicNode for example node.bodyText.

    Jeroen

  • 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