I’m trying to get nested master pages working with the new razor syntax. Any help appreciated:
The error I’m getting is
Execute() no suitable method found to override
Delving further I have my _Site.cshtml, which is the main master page and inherits ViewMasterPage.
My nested master page is _layout.cshtml, which uses _site as a layout, uses some helpers and inherits from ViewMasterPage
I have a _ViewStart.cshtml, which points to my Layout file.
And finally I have my index page which inherits from ViewPage
So at the top of each page I have:
Site:
@inherits System.Web.Mvc.ViewMasterPage
Layout
@inherits System.Web.Mvc.ViewMasterPage<MyMasterViewModel>
@{ Layout ="~/Views/Shared/_Site.cshtml"; }
ViewStart
@{ Layout ="~/Areas/AreaName/Views/Shared/_Layout.cshtml"; }
Index
@inherits System.Web.Mvc.ViewPage<MyHomeModel>
Any ideas???
Cheers!
ViewMasterPageis used for WebForms views.Razor layout pages do not inherit a special class; instead, they inherit the same
ViewPageclass.You should use the
@modeldirective instead of@inheritsin all three pages.