0

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
enter image description here

2
  • Where did you place your partial view? Put it in the Shared folder. Commented Sep 6, 2013 at 7:51
  • "doesn't work." - usually, when things don't work, they don't work in specific ways. Do you get no content? An error message? Commented Sep 6, 2013 at 7:57

1 Answer 1

3

Your view is called _ProjectMenu and you are referencing _ProjectsMenu

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.