Copied to clipboard

Flag this post as spam?

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


  • Barry 99 posts 187 karma points
    Oct 09, 2009 @ 14:51
    Barry
    0

    Getting NodeName

    How do you get the nodename or other properties for the current node.

     

    I have this

     Node EventNode = Node.GetCurrent();

      EventName = EventNode.GetProperty("NodeName").Value;

    But it causes an error

  • bob baty-barr 1180 posts 1294 karma points MVP
    Oct 09, 2009 @ 18:33
    bob baty-barr
    1

    whoohoo... i think i can answer another .net question -- this is so fun :)

    be sure to include nodeFactory... and make sure you are specifying a the String... worked for me last night.

    using umbraco.presentation.nodeFactory;

    Node myNode = Node.GetCurrent();

    String myValue = myNode.GetProperty("congratsEmail").Value;

  • Barry 99 posts 187 karma points
    Oct 09, 2009 @ 22:33
    Barry
    0

    The problem was.. you get the nodename like this..

     

     Node EventNode = Node.GetCurrent();

      EventName = EventNode.Name;

     

  • skiltz 501 posts 701 karma points
    Oct 09, 2009 @ 23:11
    skiltz
    1

     

     

    int id = umbraco.presentation.nodeFactory.Node.GetCurrent().Id;
    Document d = new Document(id);
    string nodeName = d.Text;

     

  • bob baty-barr 1180 posts 1294 karma points MVP
    Oct 10, 2009 @ 04:57
    bob baty-barr
    0

    doh, sorry Barry... did not notice you SPECIFICALLY wanted the nodeName -- i so rarely use that property for anything... i just treated it as an example of trying to access a property via nodefactory...

    gotta say, i am lovin learning more about the .net aspect of umbraco outside of just xslt macros :P

  • Matt Watson 33 posts 55 karma points
    Nov 01, 2011 @ 12:55
    Matt Watson
    0

    Thank you skiltz, Document.Text is the same as getting the nodeName value!

    :)

  • 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