"IPublishedContent does not contain a definition for 'Content' and no
extension method 'Content' accepting a first argument of type
'IpublishedContent' could be found (are you missing a suign directive
or an assembly reference?)"
If you are inheriting from UmbracoViewPage, you don't need .Content to access the Model properly. This is only required if you are inheriting from UmbracoTemplatePage.
Extended answer
UmbracoTemplatePage requires a RenderModel to be passed to it rather than just IPublishedContent. The RenderModel has a property on it called Content which is why you need to access the actual content via Model.Content. This content property is an IPublishedContent.
UmbracoViewPage, if you don't specify the model, expects an IPublishedContent (I believe) as it's default model. As such, you no longer need to access it via Model.Content as Model is the instance of IPublishedContent (or the type that was passed into the view).
Model.Content IPublishedContent does not contain a definition for "Content"
Hi, why am I not able to access "Content", am I missing a reference?
In my view:
I get the error
Best regards /David
Hi David,
Quick answer:
If you are inheriting from
UmbracoViewPage
, you don't need.Content
to access the Model properly. This is only required if you are inheriting fromUmbracoTemplatePage
.Extended answer
UmbracoTemplatePage requires a RenderModel to be passed to it rather than just IPublishedContent. The RenderModel has a property on it called
Content
which is why you need to access the actual content viaModel.Content
. This content property is an IPublishedContent.UmbracoViewPage, if you don't specify the model, expects an IPublishedContent (I believe) as it's default model. As such, you no longer need to access it via Model.Content as Model is the instance of IPublishedContent (or the type that was passed into the view).
Hope that helps
Nik
is working on a reply...