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
Hi Please see the code in my partial. Unable to access CurrentPage, can you please advise any alternatives:
This should work
@(Umbraco.AssignedContentItem.GetPropertyValue<IPublishedContent>("promoBackgroundImg").Url)
Hi Paul,
Many thanks for your help, I am able to almost complete the first site in Umbraco 7 version.
Your videos also helped me a lot to learn: https://www.youtube.com/watch?v=VWy2HlRDCRM&list=PL90L_HquhD--OWQNLyO1-KRxVDd0NPBfZ
Kind Regards
Hi,
The problem is that you are starting your view with
@inherits UmbracoViewPage
The current page property is not available then, because UmbracoViewPage only supports strongly typed content access.
To have the CurrentPage property your view should start with
@inherits UmbracoTemplatePage
Then you get access to the dynamic CurrentPage object. But I would discourage you to do that.
Please read this article I wrote for the 24 days in Umbraco which explains the difference between strongly typed and dynamic content access https://24days.in/umbraco-cms/2015/strongly-typed-vs-dynamic-content-access/
And if you decide to go with strongly typed content access read this follow up article as well : https://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/
Dave
Hi Dave,
Thanks for the post, this has give me an in depth knowledge.
I owe you and Paul Seal a LOT
you guys rock, many thanks for your help
No problem. I'm glad you got it working and you found the videos useful.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
@Umbraco.Media(CurrentPage.promoBackGroundImg).Url not working
Hi Please see the code in my partial. Unable to access CurrentPage, can you please advise any alternatives:
This should work
Hi Paul,
Many thanks for your help, I am able to almost complete the first site in Umbraco 7 version.
Your videos also helped me a lot to learn: https://www.youtube.com/watch?v=VWy2HlRDCRM&list=PL90L_HquhD--OWQNLyO1-KRxVDd0NPBfZ
Kind Regards
Hi,
The problem is that you are starting your view with
The current page property is not available then, because UmbracoViewPage only supports strongly typed content access.
To have the CurrentPage property your view should start with
Then you get access to the dynamic CurrentPage object. But I would discourage you to do that.
Please read this article I wrote for the 24 days in Umbraco which explains the difference between strongly typed and dynamic content access https://24days.in/umbraco-cms/2015/strongly-typed-vs-dynamic-content-access/
And if you decide to go with strongly typed content access read this follow up article as well : https://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/
Dave
Hi Dave,
Thanks for the post, this has give me an in depth knowledge.
I owe you and Paul Seal a LOT
you guys rock, many thanks for your help
No problem. I'm glad you got it working and you found the videos useful.
is working on a reply...