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:
BaseContentPage
MainBody (Property)
StandardContentPage (inheriting from BaseConentPage)
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.
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=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to model type MyProject.Models.ViewModels.MasterModel1[[MyProject.Models.BaseContentPage, MyProject.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].
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...
Umbraco Hybrid Framework and base Views
Hi all,
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:
And
They both currently use the _Root layout:
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:
@RenderBody()
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.MasterModel
1[[MyProject.Models.StandardPage, MyProject.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to model type MyProject.Models.ViewModels.MasterModel
1[[MyProject.Models.BaseContentPage, MyProject.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].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 Higgsy
is working on a reply...