I have the following method in my ASP.NET Core Controller
public async Task<JsonResult> MyJsonResultMethod(int page,int take, int skip, IEnumerable<Sort> sort){
...
public class Sort
{
public string field { get; set; }
public string dir { get; set; }
}
My javascript on the front end Kendo UI Web grid does a get controller method
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: "/MyController/MyJsonResultMethod"
},
pageSize: 5,
serverPaging: true,
serverSorting: true
},
height: 550,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
If I monitor it in fiddler I can catch the HTTPGet and see all the values are passed
GET http://localhost:62594/MyController/MyJsonResultMethod?take=5&skip=0&page=1&pageSize=5&sort%5B0%5D%5Bfield%5D=DocumentNumber&sort%5B0%5D%5Bdir%5D=asc
When I debug my controller method I can see all the properties passed to the method have the correct values apart from the
IEnumerable<Sort> sort
which is received as null. I tried changing it to Sort[] sort
but result is still the same
From my understanding this is unique to asp.net core and they way kendo ui sends an array. I logged the call with Telerik support says the Kendo UI Web grid doesn't support asp.net core. I can't see the reason for this as Fiddler clearly sends the data. I just need to somehow get the parameter to support it.