一个字符串数组作为参数,动作 [英] Action with a string array as parameter
本文介绍了一个字符串数组作为参数,动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要打电话用类似这样的东西的URI的动作:
的http://服务器/控制器/动作/列=名字&安培;列=姓氏和放大器;列=年龄
和使用这样的:
公众的ActionResult动作(字符串[]列)
{}
我该怎么办呢?
解决方案
谷歌是我的朋友;)
<$p$p><$c$c>http://server/controller/action/?columns[]=firstname&columns[]=lastname&columns[]=age编辑:
其实你只写正如我在原来的问题没有。究其原因,为什么我没有把它摆在首位的工作是我用在查询字符串列,并在作为动作参数列。
I want to call an action with something similar to this uri:
http://server/controller/action/?columns=firstname&columns=lastname&columns=age
and use it like this:
public ActionResult Action(string[] columns)
{
}
how do I do it?
解决方案
Google is my friend ;)
http://server/controller/action/?columns[]=firstname&columns[]=lastname&columns[]=age
Edit:
Actually you just write as I did in my original question. The reason to why I didn't get it working in the first place is that I used "column" in the query string and "columns" in as action parameter.
这篇关于一个字符串数组作为参数,动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文