0

我需要在不同的页面上添加相同的菜单,我厌倦了使用@Html.Partial
我创建了部分视图_ProjectMenu.cshtml

<ul class="sub-menu">
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_AssociationManagement, "AssociationManagement", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_WarehouseAndInventory, "WarehouseAndInventory", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_ElectronicDocumentManagement, "ElectronicDocumentManagement", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_Medicine, "Medicine", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_BankingSector, "BankingSector", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_Insurance, "Insurance", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_Websites, "Websites", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_WebApplication, "WebApplication", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_DataWarehouse, "DataWarehouse", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_MobileApplications, "MobileApplications", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_TrafficManagement, "TrafficManagement", "Projects")</li>
    <li>@Html.ActionLink(Resources.Global.Home_Menu_Project_LearningSystems, "LearningSystems", "Projects")</li>
    <li class="sector">@Html.ActionLink(Resources.Global.Home_Menu_Project_Sector, "Sector", "Projects")</li>
</ul>

然后我在我的页面上添加了这段代码

<div class="span4">
    @Html.Partial("_ProjectMenu")
</div>

但它不起作用。
我想我需要在控制器中添加一些代码,但我不知道该怎么做?

UPD我将部分视图文件放在Shared文件夹中
,但出现此异常
在此处输入图像描述

4

1 回答 1

3

您的视图称为_ProjectMenu并且您正在引用_ProjectsMenu

于 2013-09-06T08:15:30.633 回答