的Site.Master
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<body>
<asp:ContentPlaceHolder ID="Menu" runat="server">
<!-- Menu goes here -->
</asp:ContentPlaceHolder>
</body>
Sub.Master
<%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" %>
<asp:Content ID="Content4" ContentPlaceHolderID="Menu" runat= "server">
<% Html.RenderPartial("MainMenu"); %>
</asp:Content>
This is the error when the application runs: The name 'Html' does not exist in the current context
答案 0 :(得分:3)
在sub.Master指令中添加Inherits="System.Web.Mvc.ViewMasterPage"
。