I am using the Telerk Kendo UI grid that loads data remotely. The QueryString passed into my action method looks like this:-
take=10&skip=0&page=1&pageSize=10&sort[0][field]=value&sort[0][dir]=asc
I am trying to work out how to bind the sort parameter into my method? Is it possible or do I need to enumerate through the QueryString collection manually or create a custom binder?
So far I have tried this:-
public JsonResult GetAllContent(int page, int take, int pageSize, string[] sort)
public JsonResult GetAllContent(int page, int take, int pageSize, string sort)
but sort is always null. Does anyone know how I can achieve this?
I can fall back to Request.QueryString using, but this is a bit of a kludge.
var field = Request.QueryString["sort[0][field]"];
var dir = Request.QueryString["sort[0][dir]"];
You could use an array of dictionaries:
and then define a custom model binder:
which will be registered in Global.asax: