开发者

The name 'Html' does not exist in the current context

I am playing up with some code and have problem with my site master and Html tag

My application is based on asp.net MVC2 in c#

I want to use Html.RenderPartial to process my partial view in site.master. How ever it doesn't work.

Any idea?

i include my code for you to see

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="SportStore.WebUI.Views.Shared.Site" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
   <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <div id="header">
      <div class="title">Demo test</div>
    </div>
    <div id="categories">
          <% Html.RenderPartial("menu", product); %>
    </div>
    <div id="content">
        <asp:ContentPlaceHolder ID="MainContent" runat="se开发者_运维问答rver">

        </asp:ContentPlaceHolder>
    </div>

</body>
</html>


I see that your master inherits from SportStore.WebUI.Views.Shared.Site which is a custom class. Make sure that this custom class derives from System.Web.Mvc.ViewMasterPage so that the Html property is defined.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜