在同一视图中使用多个模型 [英] Using Multiple Models in same View
本文介绍了在同一视图中使用多个模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将视图绑定到MVC 2 asp.net中的多个模型类。
我有一个要求,其中,我需要准备一个绑定到两个模型类,类别和子类别的视图。
谢谢&此致,
Raghu
解决方案
你可以创建一个包装类有两个成员类别和LIST <前一个=HTML> < 子类别 >,您可以在强类型视图中传递该类
http: //francorobles.wordpress.com/2011/05/03/returning-multiple-models-in-1-view-in-asp-net-mvc3/ [ ^ ]
使用部分视图在视图中渲染多个视图
Hi,
How to bind the view to multiple model classes in MVC 2 asp.net.
I have a requirements wherein,I need to prepare a view that is bound to two model classes, "Categories" and "SubCategories".
Thanks & Regards,
Raghu
解决方案
hi ,
you can create a wrapper class which has two members Categories and LIST<SubCategories>,you can pass that class in strongly type view
http://francorobles.wordpress.com/2011/05/03/returning-multiple-models-in-1-view-in-asp-net-mvc3/[^]
Used partial views to render multiple views in a view
这篇关于在同一视图中使用多个模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文