|
|
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#).
|
|
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
|
|
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!!
|
|
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
|
|
|
Guest |