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
Hi guys, I want to bind my FooterPartial partial view to my FooterColumns document type and use the FooterPartial in Master.cshtml.
But the home page is giving me "Cannot bind source content type Umbraco.Web.PublishedContentModels.Home to model type Umbraco.Web.PublishedContentModels.FooterColumns."
I think the @RenderBody() in the Master.cshtml is rendering the Home Doc type.
Is there anything I can do? I just want the content editor able to edit the footer which is rendered in Master.cshtml
Yes, you should be able to do that.
In the call to Html.Partial() you can explicitly specify the Model as a second argument, so something like this:
var siteRoot = Model.Site();
var footer = siteRoot.Children<FooterColumns>().FirstOrDefault();
(This assumes your views inherit from UmbracoViewPage and that your FooterColumns document is a child of the "site" node, e.g. Home).
Hope that helps,
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted