ryan
ryan

Reputation: 6655

MVC2 nested master could not load type?

I've just begun experimenting with nested masters in MVC2. I'm not quite sure why I am getting this error.

Parser Error Message: Could not load type 'MySite.Views.Shared.Master'.

I used the add item wizard, created Master.master, and selected it's master to be Site.Master. In one of my views I changed the MasterPageFile from Site.Master to Master.master. I haven't changed any contents. What have I gotten wrong?

Upvotes: 0

Views: 897

Answers (1)

ten5peed
ten5peed

Reputation: 15900

It sounds like you've added a Master Page and not a MVC Master Page. You need to make sure that both of your master pages inherit from System.Web.Mvc.ViewMasterPage.

So your master page directives should look like this:

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

AND

<%@ Master MasterPageFile="~/Views/Shared/Site.Master" Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

HTHs,
Charles

Upvotes: 3

Related Questions