问题
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