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
I'm trying to access a node in the content tree using the API but i can't find any documention covering such a basic task...
I've got a simple structure Content > Home > About
How do i retrieve the About node using the API using C#?
In other CMS's it would be as simple as Context.GetItem("/content/home/about")
How is this achieved with Umbraco v5?
Thanks
Really anyone? is it not that simple?
Assuming (a) you wish to use Razor on a 4.7 installation and (b) you only know the Name, you can do this:
@Model.AncestorOrSelf(1).Where("Visible").Where("Name == \"About\"")
Let me know how this works for you
Cheers
Theo
I suppose that would work if the code is in a ViewPage...Howabout if the code was in a pure C# class without a context?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get a content node using API
I'm trying to access a node in the content tree using the API but i can't find any documention covering such a basic task...
I've got a simple structure Content > Home > About
How do i retrieve the About node using the API using C#?
In other CMS's it would be as simple as Context.GetItem("/content/home/about")
How is this achieved with Umbraco v5?
Thanks
Really anyone? is it not that simple?
Assuming (a) you wish to use Razor on a 4.7 installation and (b) you only know the Name, you can do this:
Let me know how this works for you
Cheers
Theo
I suppose that would work if the code is in a ViewPage...Howabout if the code was in a pure C# class without a context?
is working on a reply...