Get parent pageName or field from parent page/node?
I am not very experienced with Umbraco so please bare with me, this is about my 2/3 build;
I have a page called About us with sub pages called History, Our Story, where to find us, etc.
On the About Us page the title of the page comes from Field("title") or .pageName, on the subsequest pages I want to also use the "title" from the About Us page as well as the title from the current sub page, like so:
Get parent pageName or field from parent page/node?
I am not very experienced with Umbraco so please bare with me, this is about my 2/3 build;
I have a page called About us with sub pages called History, Our Story, where to find us, etc.
On the About Us page the title of the page comes from Field("title") or .pageName, on the subsequest pages I want to also use the "title" from the About Us page as well as the title from the current sub page, like so:
Parentpage.Field("title") - CurrentPage.Field("title")
How do I do this using razor?
Thanks
Simon
Hi Simon,
If you want to have the Current page name using the field title you can just do something like this
or
for the parent name
If I try and use the code you have mentioned in my umbraco template I get the following error:
I have tried using the @Model bit before and I got the same issues; Am I missing a key bit of information or library?
Hang on are you using this code in a template or in a cshtml file ?
If you are using it in a template you need to wrap the code like this
OK, So I need to use a partial view macro in Umbraco to display code like this? Is that correct?
are you using v6 ? am not very familiar with v6
I am using Umbraco 6.1.6 and asp.Net MVC + Razor.
I just need a way to show a field form the parent-page on the child page, whether this be in my template or in a partial view. :) Thanks!
Ive put this code in a partial view but it errors as below
If anyone's looking to do this, I found Model.Parent.Name wouldn't work, but Model.Content.Parent.Name would
is working on a reply...