【发布时间】:2014-07-06 17:39:58
【问题描述】:
我正在使用 SyncFusion Asp.Net MVC 网格,在此我试图在服务器端进行过滤,发送到服务器的 json 如下
但在 ViewModel 中,对象属性作为 null 不绑定
Json
{"select":["Area","Id"],"where":[{"isComplex":false,"field":"Area","operator":"startswith","value":"test","ignoreCase":true}],"sorted":[{"name":"Area","direction":"ascending"}]}
我已经创建了如下模型,它正在传递给控制器,但它没有绑定。
public class UserViewModel
{
public int skip { get; set; }
public int take { get; set; }
public Sort sorted { get; set; }
public string[] group { get; set; }
//Grid Action Params;
public string action { get; set; }
public string key { get; set; }
public string keyColumn { get; set; }
public string[] select { get; set; }
public Search search { get; set; }
public Where where { get; set; }
public ApplicationUser value { get; set; }
}
public class Where
{
public bool isComplex { get; set; }
public string field { get; set; }
public string @operator { get; set; }
public string @value { get; set; }
public bool ignoreCase { get; set; }
}
public class Sort
{
public string name { get; set; }
public string direction { get; set; }
// "sorted":[{"name":"Area","direction":"ascending"}],"group":["Area"]
}
public class Search
{
public string[] fields { get; set; }
public string @operator { get; set; }
public string key { get; set; }
public bool ignoreCase { get; set; }
}
控制器方法
public async Task<ActionResult> DataSource(UserViewModel editParams)
{
}
【问题讨论】:
标签: c# jquery asp.net asp.net-mvc json