Hi,
I would like to bind Kendo Grid using Ajax enabled WCF and returning a data either in json or xml format. But the problem is that my kendo UI Grid is not binding with my web service. The webservice returns the data without any problem. Any help would be greatly appreciated.
Webservice Data :
I would like to bind Kendo Grid using Ajax enabled WCF and returning a data either in json or xml format. But the problem is that my kendo UI Grid is not binding with my web service. The webservice returns the data without any problem. Any help would be greatly appreciated.
Webservice Data :
{"d":["20417","20418","20419","20420","20421","20422","20424","20425","20426","20427","20443","20480","20489","20491","20492","20495","20497","20498"]}[ServiceContract(Namespace = "QS")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class PSService
{
[OperationContract()]
[WebGet(BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public string[] GetJobs()
{
try
{
StringBuilder sb = new StringBuilder();
sb.Append("select ID from ff_job");
string sql = sb.ToString();
DataTable dt = Database.Instance.ExecuteQueryToDataTable(sql);
List<
string
> IJobList = new List<
string
>();
string sJobID;
foreach (DataRow dr in dt.Rows)
{
sJobID = dr["ID"].ToString();
IJobList.Add(sJobID);
}
return IJobList.ToArray();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
return null;
}
}
<div id="grid">
</div>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: { read: "http://localhost:3444/BootStrap/PSService.svc/getjobs" },
pageSize: 10
},
schema: {
model: {
fields: {
ID: { type: "number" }
}
}
},
height: 360,
groupable: true,
scrollable: true,
sortable: true,
pageable: true,
columns: [{
field: "ID",
width: 90,
title: "Job No."
}]
});
});
</
script
>