嵌套母版页上的asp.net mvc html帮助问题

时间:2010-02-25 06:12:11

标签: html master-pages helper

的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

1 个答案:

答案 0 :(得分:3)

在sub.Master指令中添加Inherits="System.Web.Mvc.ViewMasterPage"