@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
@{
var pageName = Model.Content.Name;
var childPages = Model.Content.Children;
}
<h1>@pageName</h1>
When this is run I keep getting the error:
Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
Thanks Alex - I guess I am just really confused with the documentation. There are snippits of code everywhere, but they are all missing the @inherits statements and no real cohesive examples. I have seen a lot of blog posts on the subject.
Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'Content'
Hope someone can please help with this confusing error:
I have a template calling a partial view:
Then my partial view:
When this is run I keep getting the error:
Compiler Error Message: CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'Content' and no extension method 'Content' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
The documentation on this is really vague. https://our.umbraco.org/documentation/Reference/Querying/IPublishedContent/
My goal is to create a strongly typed partial view that I can use linq queries on...
Thanks in advance,
Jamie
Hi Jamie,
Are you trying to pass to partial view current page?
You don't need to do it, all pages has Current page.
Example how it should work:
Hope it will help.
Thanks,
Alex
Thanks Alex - I guess I am just really confused with the documentation. There are snippits of code everywhere, but they are all missing the @inherits statements and no real cohesive examples. I have seen a lot of blog posts on the subject.
This section needs a major overhaul: https://our.umbraco.org/documentation/Reference/Querying/IPublishedContent/
I appreciate your feedback! Thank-you!
Jamie
You are welcome, Jamie.
Did you solve the problem?
Write all your questions on this firum, this is the best community!
Thanks,
Alex
is working on a reply...