下面是我发送到 ASP.NET MVC2 控制器的 POST 请求的屏幕截图(使用 Firebug Net 面板)。
这是接收 POST 请求的控制器/操作方法:
public ActionResult Search(int[] skill, int[] discipline, int[] education, int[] marketsector){ ... }
在我看来,发布的参数格式正确,但是操作方法接收四个空参数。您能告诉我服务器端的方法签名应该是什么样子吗?或者将这四个整数数组发布到我的 MVC2 控制器的更好方法?
它们可能看起来像这样:
<input type="text" name="discipline" value="6" />
<input type="text" name="marketsector" value="5" />
<input type="text" name="marketsector" value="7" />
<input type="text" name="marketsector" value="3" />
<input type="text" name="skill" value="3" />
<input type="text" name="skill" value="8" />
这是一个博客文章 http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx你可以看一下。还有一个类似的 http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)