I am new to Asp.Net Mvc. This is my solution hierarchy

PROJECT
    --Area 
        -- Account
            --Controllers
            --Models
            --Views
                -- Edit.cshtml
    -- Contollers (this has an action method "SomeAction")
    --Models
    -- Views
         --Shared
           --Partial.cshtml

Actually I want to render Parial.cshtml in Edit.cshtml view. So I tried

@{Html.RenderAction("ControllerName", "SomeAction");}   

But I got following error.

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

Not sure what am I missing ?

If I remove @{Html.RenderAction("ControllerName", "SomeAction");} from my view. It works fine

有帮助吗?

解决方案

You should pass area name to RenderAction method:

@{Html.RenderAction("ControllerName", "SomeAction", new{area=""});}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top