Html Helper不在嵌套站点主页面上工作

tay*_*onr 1 html asp.net-mvc html-helper

我确定我正在做一些非常愚蠢的事情,但我已经为我的应用程序的一个部分创建了一个嵌套的站点主机.

我得到了额外的文字,就像它应该在新的Site Master(Greek.Master)上一样.但是当我去为Greek.Master添加一些Html时,我发现html助手不起作用.

这是我的嵌套大师

<%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
CodeBehind="Greek.master.cs" Inherits="PaleLocust.Views.Greek.Greek" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"></asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="column">
    </div>

    <asp:ContentPlaceHolder ID="GreekMain" runat="server">
    </asp:ContentPlaceHolder>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

如果我尝试在div或GreekMain内容中执行<%= Html ....%>,它不会显示在intellisense中并导致错误消息.

它适用于原始的Site.Main(此时是ASP.NET MVC的默认版本).

所以,我错过了一些东西(可能是显而易见的),或者有没有办法让这个帮手去?

谢谢

Mar*_*tin 6

在你的嵌套母版页代码中,你继承了System.Web.Mvc.ViewMasterPage吗?

参考: 代码rant:带有MVC框架的嵌套母版页