我们如何在同一视图中显示两个视图? [英] how can we show two views in a same view?

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

问题描述

我确实遇到了问题
如何显示两个视图,一个主视图和第二个局部视图
主视图如
@model Person.Persondata


第二个局部视图是
@model ienurable< person.persondata>


actuaaly i got a problem
how can i show two view one main view and second partial view
main view in like
@model Person.Persondata


and second partial view is
@model ienurable<person.persondata>


how can we display second partial view in main page ?

推荐答案



您可以将其他模型传递给局部视图.

在您的主页中,添加以下内容:

Hi,

You can pass a different model to your partial view.

Within your main page, add the following:

<% Html.RenderPartial("ViewName", viewModelObject); %>



在您的主页上,您需要访问模型的局部视图.只需在渲染局部视图时将其传递即可.



In your main page you''ll need access to the model for the partial view. Just pass it in when you render the partial view.


您需要根据需要实现Partial View
有关更多信息,请参见:
http://www.devcurry.com/2012/04/partial- views-in-aspnet-mvc-3.html [ ^ ]

http://rachelappel.com/razor /partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/ [
You need to implement Partial View for your requirement
for more refer:
http://www.devcurry.com/2012/04/partial-views-in-aspnet-mvc-3.html[^]

http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/[^]

hope this helps.


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

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