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've been using the Umbraco Hybrid Framework for V7 which is working out really well. I'm using the MasterModel/IMasterModel concept which allows me to esentially have pages passed down to my views either as the physical IPublishedContent node, or as a ViewModel essentially - works really well.
One problem im coming up against is the following:
I have a document type setup as follows:
I then have views setup as follows:
They both currently use the _Root layout:
Layout = "~/Views/Layouts/_Root.cshtml"; }
What I'd like to acheive is to have both of these views use a _BaseContentPage.cshtml layout, because both StandardContentPage and WideContentPage share most of the HTML and all of the properties declared in BaseContentPage.
So I went about creating a Layout like so:
Layout = "~/Views/Layouts/_Root.cshtml";
And updating the views for StandardContentPage.cshtml and WideContentPage.cshtml to use that as their Layout, however then I end up with the error:
Cannot bind source type MyProject.Models.ViewModels.MasterModel1[[MyProject.Models.StandardPage, MyProject.Models, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null]] to model type MyProject.Models.ViewModels.MasterModel1[[MyProject.Models.BaseContentPage, MyProject.Models, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null]].
1[[MyProject.Models.StandardPage, MyProject.Models, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null]] to model type MyProject.Models.ViewModels.MasterModel
I can understand the error, but at the same time i can't. It's not a logic error because ModelLogic.CreateMasterModel does create the model and populates the properties inherited from BaseContentPage - it's more of a generic MVC problem I believe.
Ultimately my goals with _BaseContentPage.cshtml is to present all of the common properties/content, and then in the StandardContentPage.cshtml/WideContentPage.cshtml views to add all of the properties/content specific to that doc type - but my question is what model/inherits statement should I add to the _BaseContentPage.cshtml view?
I've used some terminology in here that strongly relates to the Hybrid framework, so apologies if I've not made it clear to some...
Thanks in advance
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted