Reputation: 3254
I need to add the same menu on different pages and I tired to use @Html.Partial
I created the partial view _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>
and then I added this code on my page
<div class="span4">
@Html.Partial("_ProjectMenu")
</div>
but it doesn't work.
I guess I need to add some code in controller, but I don't know how to do it?
UPD I placed my partial view file in Shared
folder
and I got this exception
Upvotes: 0
Views: 187
Reputation: 439
Your view is called _ProjectMenu and you are referencing _ProjectsMenu
Upvotes: 3