I'm very new Kendo UI Grid,so please excuse me if it's dumb question. I'm trying to implement basic Kendo UI Grid in asp.net with paging functionality. But I'm getting error in kendo.web.min.js.
Unhandled exception at line 13, column 15140 in http://localhost:63987/Scripts/kendo/2014.1.318/kendo.web.min.js
0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'slice'.
This is line
n._pristineData=e.slice(0)
, here 'e' is object with 'Count' and 'Data' properties which I'm returning from my web api.
Below is my web api code:
StudentController:
namespace KendoUIGridDemo
{
public class StudentController : ApiController
{
private static IEnumerable<Student> students = new Student[]
{
new Student{ ID=1,Marks=70, Name="xxxx", Result=true},
new Student{ ID=1,Marks=34, Name="xxxx", Result=false}
};
// GET api/<controller>
public Response Get(int skip,int take)
{
return new Response(students.ToArray(), students.Count());
}
}
Models:
public class Student
{
public int ID { get; set; }
public string Name { get; set; }
public string Standard { get; set; }
public double Marks { get; set; }
public bool Result { get; set; }
}
public class Response
{
public int Count { get; set; }
public Array Data { get; set; }
public Response(Array data, int count)
{
this.Data = data; this.Count = count;
}
}
.aspx page:
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/kendo/2014.1.318/kendo.web.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#studentGrid").kendoGrid({
dataSource: new kendo.data.DataSource({
transport: {
read: "api/Student"
},
pageSize: 10,
serverPaging: true
}),
sortable: true,
pageable: true
});
});
</script>
Kendo UI Grid demo
<div id="studentGrid">
</div>
</asp:Content>
I'm using "2014.1.318" version Kendo UI grid and "jquery-1.9.1.min" version.
I'm taking below as reference
http://docs.telerik.com/kendo-ui/tutorials/asp.net/hello%20kendo%20ui/asp-net-hello-kendo-ui-part-1
Am I missing anything?