views:

629

answers:

1

Hi folks, i'm trying to make my site master page (views/shared/site.master) strongly typed.

eg. Inherits="TestProject.Mvc.Views.Shared.Site"

I can't seem to get this work. Once i make the site.master page strongly, typed, Visual Studio seems to 'loose' what <%= Html.XXX %> is. Also, the page throws an error when i try to display the default index route.

The SiteMasterViewData class exists in the views/shared/ folder and has been included at the top of the master page via..

<%@ Import Namespace="TestProject.Mvc.Views.Shared"%>

Can this be done? is there a better way to do this?

+6  A: 

Damn - found my own answer.

All masterpages in the ASP.NET MVC v1. need to inherit from:

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

so if u want to strongly type it, you can do this.

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

HTH's other peeps :)

Pure.Krome