Question

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

Was it helpful?

Solution

You should pass area name to RenderAction method:

@{Html.RenderAction("ControllerName", "SomeAction", new{area=""});}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top