Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
is there any way that I can get the level of a node in c#?
basically I want to get the parent node of a node that has the level 2.
here is the site structure:
-site
-----news
------------2010
----------------08
---------------------- article 1
----- FAQ
---------- faq items
I know I can use this :
Node currentNodeRoot = Node.GetCurrent().Parent.Parent.Parent;
but I want the above code to be dynamic and as you can see FAQ the above code is not working with FAQ because of the structure.
Any thought ?
Cheers
Ali
Have a look at this topic, it should be helpful.
Thanks for your post. - your 1000th post:)
What class shall I extend to be able to do that?
Hey Ali,
I'd also check here, includes code samples
http://our.umbraco.org/forum/developers/api-questions/11190-Level-property-from-Node
Matt
thanks matt,
I am going to use this wicked code:
umbraco.presentation.nodeFactory.Node.GetCurrent().Path.Split(',').Length
Cheers Matt
is working on a reply...
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.
Continue discussion
how to get node level in c#?
is there any way that I can get the level of a node in c#?
basically I want to get the parent node of a node that has the level 2.
here is the site structure:
-site
-----news
------------2010
----------------08
---------------------- article 1
----- FAQ
---------- faq items
I know I can use this :
Node currentNodeRoot = Node.GetCurrent().Parent.Parent.Parent;
but I want the above code to be dynamic and as you can see FAQ the above code is not working with FAQ because of the structure.
Any thought ?
Cheers
Ali
Have a look at this topic, it should be helpful.
Thanks for your post. - your 1000th post:)
What class shall I extend to be able to do that?
Cheers
Ali
Hey Ali,
I'd also check here, includes code samples
http://our.umbraco.org/forum/developers/api-questions/11190-Level-property-from-Node
Matt
thanks matt,
I am going to use this wicked code:
Cheers Matt
Ali
is working on a reply...
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.