开发者

ASP.NET MVC 3.0 RenderPartial does not appear

I have this (Index)

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

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

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table style="width:100%;">
    <tr>
        <td style="width:250px;vert开发者_如何学Goical-align:top;"><%: Html.Partial("MainMenuEntity") %></td>
        <td style="vertical-align:top;">MyTest</td>
    </tr>
    </table>
</asp:Content>

MainMenuEntity.ascx

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

<% Html.ActionLink("Home", "Index", "Home"); %><br />
<% Html.ActionLink("Customer", "Index", "Customer"); %><br />
<% Html.ActionLink("Product", "Index", "Product"); %><br />
<% Html.ActionLink("Estimation", "Index", "Estimation"); %><br />
<% Html.ActionLink("Invoice", "Index", "Invoice"); %>

But the link does not appear when I execute only "MyTest" is how.

Any ideas?


Html.ActionLink returns a MvcHtmlString. So call it this way in order to have it output the already encoded HTML:

<%: Html.ActionLink("Home", "Index", "Home") %>

Note the starting ":" which writes the MvcHtmlString to the page and the lack of ";" at the end.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜