Copied to clipboard

Flag this post as spam?

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


  • Will Sanders 19 posts 39 karma points
    Jan 31, 2011 @ 22:20
    Will Sanders
    0

    Get Node by ID in User Control

    Hi, is it possible to get a Node by passing some method that node's ID?

    In umbraco.NodeFactory, there's a GetNodeByXpath method but I'd like to use and ID.

    Thanks.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 31, 2011 @ 22:23
    Kim Andersen
    1

    Hi Will

    You should be able to use the umbraco.library extension called getXmlNodeById(string nodeId).

    /Kim A

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 31, 2011 @ 22:27
    Tom Fulton
    1

    You can also use something like

    Node n = new Node(1234);

    1234 being the ID of the node.

    -Tom

  • Will Sanders 19 posts 39 karma points
    Jan 31, 2011 @ 22:27
    Will Sanders
    0

    Thanks for the speedy reply Kim! Moments after I posted this I found a way to do it (I think) -

    Node myNode = new Node(myID)

    Just curious, what assembly is the umbraco.library located? It's not immediately obvious to me. 

    Thanks again.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 31, 2011 @ 22:29
    Tom Fulton
    0

    Looks like you figured it out :)

    umbraco.library is in umbraco.dll I believe

Please Sign in or register to post replies

Write your reply to:

Draft