I am working on asp.net MVC with Kendo UI grid. I am getting the information from a method and give it to the grid. and I have in toolbar a datepicker so when I pick a new date the code will go to the method refilter the LINQ then I received a new list.
I wrote this code:
public ActionResult Grid_ReadLogAdminList([DataSourceRequest] DataSourceRequest request,[Bind(Prefix = "id")] string date)
{
//both the date and result is correct always
var jsonResult = Json(result, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
}
and here is the javascript when I change the datepicker:
function filterDate()
{
$("#LogAdminGrid").kendoGrid({
dataSource: {
transport: {
read: {
url: '/LogAdmin/Grid_ReadLogAdminList/',
type: 'get',
dataType: 'json',
data: {
id: kendo.toString($("#datepicker").data("kendoDatePicker").value(), "dd.MM.yyyy")
}
}
}
}
});
}
everything is correct and I can access the method correctly. but after the return of the method after the filter I receive and error:
kendo.all.js:6599 Uncaught TypeError: e.slice is not a function
I don't know why and how to solve it. please if you can help me with it?
As you are use the kendo ui MVC grid so i would suggest that go with below method.
View
Controller
Modal
The root cause of the error "e.slice is not a function" is that instead of binding array to the kendo grid we binding object. (because we can apply slice method array only)