gpt4 book ai didi

asp.net - 将 int 数组发布到 MVC Controller - 正确的方法签名是什么?

转载 作者:可可西里 更新时间:2023-11-01 15:27:11 25 4
gpt4 key购买 nike

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

post request snapshot

这是接收 POST 请求的 Controller /操作方法:

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

POSTed 参数在我看来是正确的形式,但是操作方法接收四个空参数。你能告诉我方法签名在服务器端应该是什么样子吗?或者将这四个整数数组发布到我的 MVC2 Controller 的更好方法?

最佳答案

它们可能看起来像这样:

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

这是一个 blog post你可以看看。还有一个similar one .

关于asp.net - 将 int 数组发布到 MVC Controller - 正确的方法签名是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5002952/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com