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
How do you find the id of a node type by its alias using the API without jquery?
Can it be accessed directly like in razor e.g Model.AncestorOrSelf().Descendants("MyTypeAlias").First() ?
In V6 Mvc it is @CurrentPage.Id (or Model equivalent), but it very much now depends upon the version of Umbraco you are using. It will also depend on what you want to do with the node, once you have it as to the best way forward.
Even though dated the link below is a very good source to point you in the direction to achieving the call you need. (I believe it was created for 4.7, but is still very useable, even if not 100% in every detail)
Hope it helps
If you want to get a node anywhere inside Umbraco (here the property "Name" in node 1105), you can use @Model.NodeById(1105).Name. Hope that this helps you :-)
So you have to use .Where in the api, shame there isn't a direct handler.
or how about:
Node firstCaseStudyNode = uQuery.GetNodesByType("CaseStudy").First();
@Richard, I'd suggest against hardcoding IDs in the config, for example IDs may change then deploying a site via Courier - such nodes would likely have unique document types so easy to find via the API (the above uses XPath internally so nice and quick).
I support Hendy's answer because this ist the fastest why and even cached.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted