如何使用剃刀引擎将列表从视图传递到MVC3中的控制器 [英] How to pass a list from view to controller in mvc3 using razor engine
本文介绍了如何使用剃刀引擎将列表从视图传递到MVC3中的控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一种情况,我必须将列表类型参数从视图传递到控制器.谁能帮我这个忙.
谢谢与问候,
R Mahesh
Hi,
I have a scenario that I have to pass a list type argument from view to controller. Can anyone please help me in this.
Thanks & Regards,
R Mahesh
推荐答案
您的视图应实现要从视图传递到控制器的列表的类型.
例如:
Your view should implement the type of list you want to pass from the view to the controller.
for example:
@model ICollection<mynamespace.models.thing>
现在我还不是专家,我不知道这是否是最好的方法,但是它对我有用,也有一定的道理.
请注意,我使用的剃刀视图不是aspx.
now I''m not an expert and I don''t know if this is the best way to do it , but it works for me and it kinda makes sens too.
Note that I''m using razor views not aspx.
这篇关于如何使用剃刀引擎将列表从视图传递到MVC3中的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文