CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'getProperty' and no extension method 'getProperty' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
I get past this error when I capitalized the "G" in GetProperty. Now I get an empty object error, not a definition error (I think this is good).
I'll mess around with it today and let you know what I find.
Everybody: please jump in if you think you know what the problem is.
Are you sure about your property name with a space ? This seems strange as when you create a property the alias is generated without space and in camel case...
What is the easiest way to get a selected dropdown prevalue as string?
Hello All,
I'm pretty new to Umbraco, and i'm loving it so far. I would love it even more if I knew how to get a selected value from a dropdown list.
I was hoping I can pull the value in 1 line of code for my shorthand conditional statement, like so:
basically, if the prevalue "right" is selected, then I would float the div to the right.
I read this article, which brought me a little closer, but no success: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/dropdown-list-publishing-keys
What am I doing wrong?
Thanks in advance.
Hope this helps :
Thanks Christopher,
I get a compilation error:
CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'getProperty' and no extension method 'getProperty' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
I get past this error when I capitalized the "G" in GetProperty. Now I get an empty object error, not a definition error (I think this is good).
I'll mess around with it today and let you know what I find.
Everybody: please jump in if you think you know what the problem is.
Thanks in advance.
It's may be better to check if you have the property as well with HasProperty:
Are you sure about your property name with a space ? This seems strange as when you create a property the alias is generated without space and in camel case...
MrFlo,
That did it. Here's the the working code
Looks like I should have been using the alias rather than the property name. Thanks for your help!
is working on a reply...