'IPublishedContent' does not contain a definition for 'Value' and no accessible extension method 'Value' accepting a first argument of type 'IPublishedContent' could be found
example :
var title = Model.HasValue(alias: "title") ? Model.Value
The syntax you've posted above is the new syntax in Umbraco V8 - but noticed that you have selected V7 when posting the question... anyway if you are running V7 the syntax would be:
var title = Model.Content.HasValue("title") ? Model.Content.GetPropertyValue<string>("title") : Model.Content.Name;
If you are running V8 then it would be:
var title = Model.HasValue("title") ? Model.Value<string>("title") : Model.Name;
Getting error while accessing Value from Model i.e Model.Value
'IPublishedContent' does not contain a definition for 'Value' and no accessible extension method 'Value' accepting a first argument of type 'IPublishedContent' could be found
example :
var title = Model.HasValue(alias: "title") ? Model.Value
Hi Babaso
Which version of Umbraco are you using?
The syntax you've posted above is the new syntax in Umbraco V8 - but noticed that you have selected V7 when posting the question... anyway if you are running V7 the syntax would be:
If you are running V8 then it would be:
regards
Marc
Thanks Marc, Yes, I am using Umbraco 7 and above syntax wont work.
Instead, I have used below syntax and its worked.
One way : Model.Title
Second way : Model.GetPropertyValue("title")
Thank you
is working on a reply...