.NET MVC:从视野中回传的复杂对象或列表阵列控制器阵列、控制器、视野、回传

2023-09-06 08:15:25 作者:っ姑娘你薄凉如初

我想从查看到提交表单的控制器传递一个列表阵列。 我可以通过使用Html.hidden()函数传递回简单值。但是,一个人如何传回一个复杂的对象或List阵列

I want to pass a list array from the View to the controller on submission of the form. I can pass back simple values by using the Html.hidden() function. But how does one pass back a complex object or a List array

推荐答案

您可以使用JSON或看看下面的例子

You can either use Json or look into the following example

的http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/