sanjeev
sanjeev

Reputation: 1407

Html.RenderAction from different directory

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

Upvotes: 0

Views: 2167

Answers (1)

Kirill Bestemyanov
Kirill Bestemyanov

Reputation: 11964

You should pass area name to RenderAction method:

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

Upvotes: 4

Related Questions