Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Site.Master和ASP.NET MVC存在问题_Asp.net Mvc_Master Pages - Fatal编程技术网

Asp.net mvc Site.Master和ASP.NET MVC存在问题

Asp.net mvc Site.Master和ASP.NET MVC存在问题,asp.net-mvc,master-pages,Asp.net Mvc,Master Pages,我正在尝试使我的站点母版页(视图/shared/site.master)强类型化 例如,Inherits=“TestProject.Mvc.Views.Shared.Site” 我似乎找不到这份工作。一旦我将site.master页面设置为强类型,VisualStudio似乎“松散”了的内容。另外,当我试图显示默认索引路由时,页面会抛出一个错误 SiteMasterViewData类存在于views/shared/文件夹中,并通过..包含在母版页顶部 <%@ Import Namespac

我正在尝试使我的站点母版页(
视图/shared/site.master
)强类型化

例如,Inherits=“TestProject.Mvc.Views.Shared.Site”

我似乎找不到这份工作。一旦我将site.master页面设置为强类型,VisualStudio似乎“松散”了
的内容。另外,当我试图显示默认索引路由时,页面会抛出一个错误

SiteMasterViewData类存在于views/shared/文件夹中,并通过..包含在母版页顶部

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


这能做到吗?有更好的方法吗?

该死-找到了我自己的答案

ASP.NET MVC v1中的所有母版页。需要继承自:

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

所以如果你想强式输入,你可以这样做

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

HTH的其他窥视:)