3
votes

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

2

2 Answers

1
votes

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

0
votes

In case of WebApi controller, you could use [FromUri] attributes and GET verb:

    public HttpResponseMessage Get(
[FromUri]IEnumerable<SortParameter> sort, 
[FromUri]FilterContainer filter, 
int take = 10, int skip = 0)