将int数组发布到MVC控制器 - 什么是正确的方法签名? [英] Posting int arrays to MVC controller - what would be the correct method signature?

查看:197
本文介绍了将int数组发布到MVC控制器 - 什么是正确的方法签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是POST请求的截图(使用Firebug Net面板)我发送到我的ASP.NET MVC2控制器。

Below is a screenshot of the POST request (using Firebug Net panel) I am sending to my ASP.NET MVC2 controller.

这是接收POST请求的控制器/操作方法:

This is the controller / action method that receives the POST request:

public ActionResult Search(int[] skill, int[] discipline, int[] education, int[] marketsector){ ... }

参数POSTed在我看来是正确的形式,四个空参数。你能告诉我方法签名在服务器端应该是什么样子吗?

The parameters POSTed seem to me to be in the correct form, however the action method receives four null arguments. Could you please tell me what should the method signature look like on the server side? Or a better way of posting these four integer arrays to my MVC2 controller?

推荐答案

它们可能看起来像这样:

They could look like this:

<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" />

这是一个博文,你可以看看。和类似的

And here's a blog post you may take a look at. And a similar one.

这篇关于将int数组发布到MVC控制器 - 什么是正确的方法签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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