My grid that is bound to json data is not displaying the data. Here is my code.
<script>
var remoteDataSource = new kendo.data.DataSource(
{
transport:
{
read: {
type: "get",
dataType: "json",
url: "http://localhost:50411/EmployeeService.asmx/GetData",
contentType: "application/json; charset=utf-8"
}
},
pageSize: 4
})
$("#grid").kendoGrid(
{
dataSource: remoteDataSource,
columns: [
{
field: "pin",
title: "PIN",
width: 600,
filterable: true
},
{
field: "firstName",
title: "First Name",
width: 100,
filterable: true
},
{
field: "lastName",
title: "Last Name",
filterable: true,
},
],
schema: {
data: "list"
},
height: 430,
scrollable: true,
sortable: true,
pageable: true,
});
</script>
Im using an asmx webmethod.
[WebService(Namespace = "http://localhost/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class EmployeesService : System.Web.Services.WebService
{
[WebMethod]
public static string GetData()
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<DepartmentEmployees> employees = EmployeeRules.GetDepartmentEmployeeses(Debug.GetEmployees(20));
return serializer.Serialize(employees);
}
}