Hello, How can I show the value of the property in multiple page using partial view? I tried the code below but its only showing on master. Thank you in advance.
I am amusing you have the footerAddress on your root node.
I'd like to think of Model as the current page. So your code won't work on a subpage since the subpage doesn't have the footerAddressproperty. So what you need to do is get the root node. Something like this:
Partial View
Hello, How can I show the value of the property in multiple page using partial view? I tried the code below but its only showing on master. Thank you in advance.
@using Umbraco.Cms.Web.Common.PublishedModels; @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels; @{ Layout = null; }
Hi Sam!
I am amusing you have the
footerAddress
on your root node.I'd like to think of
Model
as the current page. So your code won't work on a subpage since the subpage doesn't have thefooterAddress
property. So what you need to do is get the root node. Something like this:Hope this helps!
//Johannes
Above is totally correct. You can also do a recursive property.
https://our.umbraco.com/Documentation/Reference/Querying/IPublishedContent/Properties/#fallbacks
But this is only a best practice when the property is on every node but not filled in on every item
Thanks Julien. You just helped me reduce my code. I never heard of the fallback option. I just reduced the code by 12 lines.
Thank you Julien its working fine now.
is working on a reply...