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
When using in a partial view
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel>
I get the following error
Cannot bind source content type ModelsBuilder.APIMode.Models.Home to model type ModelsBuilder.APIMode.Models.MyBlogPost.
According to the Umbraco docs, https://our.umbraco.com/documentation/Reference/Templating/Mvc/partial-views Under Strongly typed Partial Views the above code should work
Any ideas on why it doesn't? I'm using 7.10.4
Madison
Are you passing your blog post model explicitly to the partial? If you don't, then it will pass the Model of the view the page is on.
So don't do this:
@Html.CachePartial("MyPartial")
Do this:
@Html.CachePartial("MyPartial", blogPost)
Where blogPost is you strongly typed MyBlogPost model.
blogPost
MyBlogPost
Thank you Dan, I just got the same info from Nik on a question relative to the error being caused from this one.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel> causes error
When using in a partial view
I get the following error
Cannot bind source content type ModelsBuilder.APIMode.Models.Home to model type ModelsBuilder.APIMode.Models.MyBlogPost.
According to the Umbraco docs, https://our.umbraco.com/documentation/Reference/Templating/Mvc/partial-views Under Strongly typed Partial Views the above code should work
Any ideas on why it doesn't? I'm using 7.10.4
Madison
Are you passing your blog post model explicitly to the partial? If you don't, then it will pass the Model of the view the page is on.
So don't do this:
Do this:
Where
blogPost
is you strongly typedMyBlogPost
model.Thank you Dan, I just got the same info from Nik on a question relative to the error being caused from this one.
is working on a reply...