Click here to Skip to main content
15,913,722 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
XML
Areas/Shared/Controllers/ PvAddressFinderController.cs

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

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


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

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    
    
    @using (Html.BeginForm()) 
    {
        @Html.AntiForgeryToken()
        @Html.Action("index", "~Shared/Controllers/PvAddressFinder");
       
    }
    
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
</body>
</html>


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
Posted

1 solution

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

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

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