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 guys
I just started movinga site from v7 to v8, but keep running into some trouble.
I keep getting this error for most of my views and macros.
'IPublishedContent' does not contain a definition for 'GetPropertyValue'
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using Umbraco.Web @{ if (Model.Content.HasValue("canonical")){ var node = Model.Content.GetPropertyValue<int>("canonical"); <link rel="canonical" href='@node.Url'> }else{ <link rel="canonical" href='@Model.Content.Url'> } }
What changed, that makes these definitions not work?
Hope you guys can help me out.
Best
Henrik
Try Model.Content.Value<int>("canonical"); instead. :)
Model.Content.Value<int>("canonical");
Thanks Sebastiaan!
That worked.
Makes sense now. Figured out earlier that @Umbraco.Field was also changed to @Model.Value.
Are these changes new to v8?
They are! Some further reading: https://shazwazza.com/media/1032/uduf-2019.pdf
Awesome thanks! 😊
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Problems with v7 macros and views
Hi guys
I just started movinga site from v7 to v8, but keep running into some trouble.
I keep getting this error for most of my views and macros.
'IPublishedContent' does not contain a definition for 'GetPropertyValue'
What changed, that makes these definitions not work?
Hope you guys can help me out.
Best
Henrik
Try
Model.Content.Value<int>("canonical");
instead. :)Thanks Sebastiaan!
That worked.
Makes sense now. Figured out earlier that @Umbraco.Field was also changed to @Model.Value.
Are these changes new to v8?
Best
Henrik
They are! Some further reading: https://shazwazza.com/media/1032/uduf-2019.pdf
Awesome thanks! 😊
is working on a reply...