Html Helper Not Working on nested Site Master page

杀马特。学长 韩版系。学妹 提交于 2020-01-05 10:58:26

问题


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

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.

Here's my nested master

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

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.

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?

Thanks


回答1:


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

Reference: Code rant: Nested Master Pages with the MVC Framework



来源:https://stackoverflow.com/questions/1989921/html-helper-not-working-on-nested-site-master-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!