Skip to content
Loading
}
}
}
and then in my Layout.cshtml i am calling this partial view as
@{ Html.RenderAction("DisplayMenu", "MenuController");}
its gives an exception like that

The controller for path '/' was not found or does not implement IController.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The controller for path '/' was not found or does not implement IController.

Source Error:

CSS
Line 31:  Line 32:     @* @Html.Partial("_Header")*@ Line 33:    @{ Html.RenderAction("DisplayMenu", "MenuController");} Line 34:     @RenderBody() Line 35:     @Html.Partial("_Footer")
0
  • Saineshwar Bageri
    0
    Hi Mark Tabor,
    The Controller name must be Menu not MenuController
    Just make this change.
    Code
    @{ Html.RenderAction("DisplayMenu", "Menu");}
    0
  • 0
    Thanks you for your continous response Saineshwar I have changed the Controller Name from MenuController to Menu Now i am getting that error

    The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[BusinessApplicationTemplate.Models.Menu]', but this dictionary requires a model item of type 'BusinessApplicationTemplate.Models.Menu'.

    0
  • Saineshwar Bageri
    0
    Check model which you are passing to Partial view
    if you are using collection of model then pass collection from collection of model and
    if you are passing simple model then check you Partial view should take simple model as input
    0
  • 0
    y Model is as below and my partial view code is i have now include IEnumerable which was not previouslly added .my partial menu code is
    @model IEnumerable
      @foreach (var menuLevel1 in ViewBag.MenuLevel1)
      {
    • @menuLevel1.Name
    • @if (menuLevel1.Child.Count > 0)
      {
        @foreach (var menuLevel2 in menuLevel1.Child)
        {
      • @menuLevel2.Name
      • }
        }
        }
        my
        0
      • Saineshwar Bageri
        0
        then it is showing or not
        0
      • 0
        it is not giving any error but showing nothing but instead if i make my Menu Partial view as static like below then it is show the static menu
      • @Html.ActionLink("Services","Index","Services")
      • @Html.ActionLink("News","Index","Menu")
      • @*
      • News
      • *@
        0