【发布时间】:2019-10-02 06:22:55
【问题描述】:
我正在使用Jquery-bootgrid 创建表。在文档中将这种参数传递给控制器
current=1&rowCount=10&sort[columnName]=asc&searchPhrase=&id=b0df282a-0d67-40e5-8558-c9e93b7befed
我可以得到所有参数值,除了括号sort[columnName]=asc,我通过创建具有相同属性名称的类来获取参数,就像参数中一样
public class Bootgrid
{
public int current { get; set; }
public int rowCount { get; set; }
public string searchPhrase { get; set; }
public string[] sort{ get; set; } //can't get the value
}
请指教
【问题讨论】:
-
我不明白你为什么要发送一个字符串数组,而你可以只发送一个用于排序类型的字符串变量
-
你能试试输入
IEnumerable<string>而不是string[]吗? -
sort只是一个字符串,而不是一个数组。你试过public string sort{get;set;}吗? -
在任何情况下,查询参数数组都没有语法,每个平台/应用程序都使用自己的约定。有些重复相同的名称,例如
foo=a&foo=b。有些使用值列表foo=a,b。有些人用方括号重复名称foo[]=a&foo[]=b
标签: c# asp.net-mvc rest jquery-bootgrid