在主页面的不同文件夹中调用部分视图 [英] calling partial view in a different folder in a main page

查看:64
本文介绍了在主页面的不同文件夹中调用部分视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好那里

我正在MVC上工作部分查看

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是



index.cshtml is

@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>


当我运行时,


。它突出显示了@ Html.Action(index,~Shared / Controllers / PvAddressFinder);并说



路径'/ MyAccount / BillingAddressChange / Index'的控制器未找到或未实现IController。







但是当我拿@Html.Action(index,~Shared / Controllers / PvAddressFinder)时,它正在挽回页面。 ;



我如何渲染主页上的局部视图



感谢您的所有帮助



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

推荐答案

这里的问题是路径语法错误。尝试如下。



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

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


这篇关于在主页面的不同文件夹中调用部分视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆