var testValue = vMember.GetPropertyValue("myCustomProperty");
has the error: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
Get a member's custom property
How do I get the value of a custom property of type true/false?
I have manually set it to true.
I am using MVC Raxor and I get the member with:
In debug, I can see the custom property (by examining vMember) in Properties > Umbraco.Core.Models.IPublishedProperty[0].
According to Intellisense, "HasValue" and "GetPropertyValue" are not available and "GetProperty("customProperty").Value gives an error.
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Hi Roger,
It works fine:
What version of Umbraco are you using?
Thanks,
Alex
Thanks Alex, but no joy.
has the error: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
I'm using 7.2.8.
Any thoughts?
Roger
Be sure you are using the namespace
Umbraco.Web
to get theGetPropertyValue
extension methods.ie. in a view add
@using Umbraco.Web
or in a classusing Umbraco.Web;
is working on a reply...