如何在MVC的同一视图中使用来自不同控制器的两个视图? [英] How to use two views from different controllers in the same view in MVC?

查看:59
本文介绍了如何在MVC的同一视图中使用来自不同控制器的两个视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MVC的同一视图中使用来自不同控制器的两个视图?

我有两个不同的视图,一个是局部视图,另一个不是局部视图,我必须使用他们在一个新视图中如何做到这一点?

How do I use two views from different controllers in the same view in MVC?
I have two different views one is partial view and the other one is not a partial view and I have to use them together in a new View how can i do that?

推荐答案

我将局部视图移动到共享视图文件夹,以便我能够在完整视图中调用它并得到它
I moved the partial view to the shared view folder so I was able to call it in the full view and got it


是这里如果控制器的Action方法的视图都没有布局,RenderAction()可以是一个解决方案。简单来说,视图需要布局= null;

希望你明白这一点。

谢谢
Yes here RenderAction () can be a solution if none of the controller's Action method' s views have the layout. In simple words the views need to have layout = null;
Hope you get the point.
Thanks


这篇关于如何在MVC的同一视图中使用来自不同控制器的两个视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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