nodeFactory GetCurrent() method question Options
carman
Posted: Friday, September 07, 2007 11:57:47 AM
Rank: Enthusiast

Joined: 6/12/2007
Posts: 13
Hi!

I've a problem fetching specific node form umbraco, let's say I have very simple nodes stucture:

Content:
-> lvl1 Node 1
-> lvl1 Node 2
-> lvl1 Node 3

And now let's say my current node is Node 2 (which is returned by GetCurrent() method).
How can I get Node object for Node 1 or Node 3 ?

Returned node has only Parent and Childres collections but I need specific node on the same level (I can't get higher and then go down in foreach loop lookin' for that node, becouse parent node for that nodes is null).

Thanks in advance for help.
(I don't need it in XSLT but programmaticaly in C#).
pph
Posted: Friday, September 07, 2007 12:07:23 PM
Rank: Aficionado

Joined: 7/19/2006
Posts: 171
Location: aalleren, Denmark
from the top of my head I think it's something like this:

Node ParentNode = umbraco.presentaion.nodeFactory.Node.GetCurrent().Parent;

foreach(node nl in ParentNode.Children)
{
//do stuff with nodes on the same level as the current one...
}

Umbracian Personal blog: Objects.dk
carman
Posted: Friday, September 07, 2007 12:18:44 PM
Rank: Enthusiast

Joined: 6/12/2007
Posts: 13
So your replay negates my words:

"I can't get higher and then go down in foreach loop lookin' for that node, becouse parent node for that nodes is null"

I checked it twice -> for nodes on lvl1 parent node is NULL!!
pph
Posted: Friday, September 07, 2007 1:30:29 PM
Rank: Aficionado

Joined: 7/19/2006
Posts: 171
Location: aalleren, Denmark
okey so instead of writing in uppercase you could take a look at:

umbraco.cms.businesslogic.web.Document.GetRootDocuments();

- which either returns the system root of the content section or the ones at leve1 either way it should solve your problem.


Umbracian Personal blog: Objects.dk
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.