如何读取这个Json到控制器对象?(How to read this Json to controller object? Kendo UI grid server filtering)

编程入门 行业动态 更新时间:2024-10-28 12:17:28
如何读取这个Json到控制器对象?(How to read this Json to controller object? Kendo UI grid server filtering)

我正在尝试过滤Kendo UI网格服务器端过滤器。 开发人员工具在查询字符串中显示此内容

/ Home / GetUsmMessage?{“filter”:{“logic”:“and”,“filters”[{“field”:“MessageId”,“operator”:“eq”,“value”:1}]},“ group“:[]} GET 200 application / json

我创建了一个对象结构,以便我将结构读入对象

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

过滤容器的对象结构:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

当我调试控制器功能时,它仍然给我一个空对象。 请帮忙

I am trying to filter Kendo UI grid server side filter. The developer tools show this in query string

/Home/GetUsmMessage?{"filter":{"logic":"and","filters" [{"field":"MessageId","operator":"eq","value":1}]},"group":[]} GET 200 application/json

I created a object structure so that I read the structure to object

public ActionResult GetUsmMessage(FilterContainer filter) { //Code to read the filter container return Json(jsonData, JsonRequestBehavior.AllowGet); }

Object structure for filter container:

public class FilterContainer { public List<FilterDescription> filters { get; set; } public string logic { get; set; } } public class FilterDescription { public string @operator { get; set; } public string field { get; set; } public string value { get; set; } public List<FilterDescription> filters { get; set; } public string logic { get; set; } }

It still gives me a null object when I debug controller function. Please help

最满意答案

得到了答案......我忘了添加请求类型作为Http帖子....

Got the answer...I forgot to add type of request as Http post ....

更多推荐

本文发布于:2023-08-08 00:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466709.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制器   对象   controller   read   Json

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!