views:

85

answers:

1

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?

+2  A: 

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

Charlino