Click here to Skip to main content
15,029,010 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello there
I am working a on a MVC Partial view the folder in
Areas/Shared/Controllers/ PvAddressFinderController.cs

and the partial view in
Areas/Shared/Views/ PvAddressFinder/Index.cshtml

I wanted to render my above partialview in my main page which is in the
Areas/MyAccount/Controllers/ BillingAddressChangeController.cs
Areas/MyAccount/view/ BillingAddressChange/index.cshtml

index.cshtml is
@model AccountPortal.Areas.MyAccount.Models.ChangeBillingAddressModel

<!DOCTYPE html>

    <meta name="viewport" content="width=device-width" />
    @using (Html.BeginForm()) 
        @Html.Action("index", "~Shared/Controllers/PvAddressFinder");
        @Html.ActionLink("Back to List", "Index")

when i run it. it highlights the @Html.Action("index", "~Shared/Controllers/PvAddressFinder"); and says

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

but it is loarding the page fine when i take the @Html.Action("index", "~Shared/Controllers/PvAddressFinder");

how do i render the partial view on my main page

appreciate all your help

1 solution

Your problem here is the wrong path syntax.Try is as below.

@Html.Action("index", "~/Shared/Controllers/PvAddressFinder");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900