Current Node from c# Options
darrenferguson
Posted: Tuesday, July 25, 2006 3:16:35 PM
Rank: Devotee

Joined: 7/19/2006
Posts: 83
Hello all,
Is there a better way of retreiving the current node using C# than this:

XmlNode n = ((IHasXmlNode) umbraco.library.GetXmlNodeCurrent().Current).GetNode();

It doesn't really seem very efficient to have to get the XML and then get the id attrbute.

D.

Darren Ferguson - http://www.darren-ferguson.com
hartvig
Posted: Wednesday, July 26, 2006 8:21:59 AM

Rank: Addict

Joined: 3/17/2008
Posts: 953
Location: Nyborg, Denmark
Yes, you can use the nodefactory that was introduced in 2.1:

umbraco.presentation.nodeFactory.Node.GetCurrent().Id

Jeeeez, did I really start this :-)
darrenferguson
Posted: Wednesday, July 26, 2006 1:20:16 PM
Rank: Devotee

Joined: 7/19/2006
Posts: 83
Cheers mate.

Darren Ferguson - http://www.darren-ferguson.com
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.