HTML辅助不工作嵌套的网站主页上 [英] Html Helper Not Working on nested Site Master page

查看:116
本文介绍了HTML辅助不工作嵌套的网站主页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我在做一些非常愚蠢的,但我已经创建了一个嵌套的网站主为我的应用程序的一个部分。

I'm sure I'm doing something really stupid, but I've created a Nested Site master for one section of my app.

我得到了额外的文本展现出来,像它应该在新的Site Master(Greek.Master)。但是,当我去添加一些HTML来Greek.Master,我发现了HTML辅助不工作。

I got the extra text to show up, like it should on the new Site Master (Greek.Master). But when I went to add some Html to Greek.Master, I found out the html helper isn't working.

下面是我的嵌套母

<%@ 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>

如果我尝试做&LT;%= HTML ....%>在DIV或GreekMain内容,它并没有在智能感知显示出来,并导致一个错误信息

If I try to do <%= Html.... %> in the div or the GreekMain content, it doesn't show up in the intellisense and causes an error message.

它工作在原有的Site.Main(这在这一点上是默认的在ASP.NET MVC)。

It works on the original Site.Main (which at this point is the default one with ASP.NET MVC).

所以,我失去的东西(可能是显而易见的),或者是有办法做到这得到帮助回事?

So am I missing something (probably obvious) or is there a way to do get this helper going?

感谢

推荐答案

在您的嵌套母版页code的后面,你从 System.Web.Mvc.ViewMasterPage

In your nested master page code behind, do you inherit from System.Web.Mvc.ViewMasterPage ?

参考:
code咆哮:嵌套母版页的MVC框架

这篇关于HTML辅助不工作嵌套的网站主页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆