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
I simply cannot get the grid to render in Umbraco8, and I do not know why.
I have a page with a grid on it with the alias "contentGrid"
I have a template file like this:
Layout = "master.cshtml";
@* the fun starts here *@
As documented here
But I get a
'IPublishedContent' does not contain a definition for 'Content' and no accessible extension method 'Content' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
Well, maybe I am, but I do not know which one.
I read somewhere, that I do not need to add .Content in U8, but then I get
No property type found with alias contentGrid
What to do?
You need to figure out what model you are trying to render. Umbraco is telling you that you are trying to render a model that does not have the "contentGrid" property.
How is that view being used? What model are you passing on to it etc. ?
Okay, I was trying to make the example clearer, and stumbled upon the solution. Thanks you Søren, for prompting me to do that.
For future reference, I was missing a line, so the correct example should look like this:
@using ContentModels = Umbraco.Web.PublishedModels;
Layout = null;
It looks like "
Remember in Umbraco 8 the RenderModel has been removed and simplified, so there is no longer Model.Content just Model.
I guess we now could have a property with alias content and access it using Model.Content using ModelsBuilder, which in v7 would cause collisions.
Thank you very much!
Documentation's seems to be outdated and I've created related issue.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted