0
我剛開始使用Kendo UI網格。我試圖讓它工作W/ASP.NET Web服務。Kendo UI Grid並未調用ASP.NET Web服務
這裏的JS我要創建網格:
$("#grid").kendoGrid({
pageable: true,
dataSource: {
serverPaging: true,
schema: { data: "d.Records", total: "d.total" },
pageSize: 10,
type: "json",
transport: {
read: {
url: "/services/Records.asmx/GetRecords",
dataType: "json",
type: "POST",
contentType: "application/json; charset-utf-8"
}
}
},
rowTemplate: kendo.template($("#kendoTmpl").html())
});
下面是Web方法(只是測試的事情了明顯)代碼:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Function GetRecords() As RecordList
Dim x as List(Of Record) = New List(Of Record)
Dim total as Integer = 25
Dim skipVal as Integer = Convert.ToInt32(HttpContext.Current.Request.QueryString("skip"))
Dim takeVal as Integer = Convert.ToInt32(HttpContext.Current.Request.QueryString("take"))
For i as Integer to total
'Record class has ID and Detail properties
x.Add(new Record(i, "This is Record #" + i.ToString()))
Next
'RecordList has Total and Records properties
Return New RecordList(total, x)
End Sub
我也引用瓦特/頁面:
jquery.min.js //jQuery v1.9.1
kendo.all.min.js
kendo.web.min.js
我已經在webmethod中設置了斷點w /,但它們從未受到影響。我錯過了什麼?
1.不需要kendo.web.min.js,它kendo.all.min.js被包圍。此外,打開你的開發工具或提琴手或其他東西,看看是否將Ajax請求發送到服務器。 – 2014-12-02 20:37:19
感謝您的提示。它的狀態碼是500,這是很奇怪的,因爲其他服務工作正常。我在本地運行一切。 – user1147941 2014-12-02 21:05:30
進入細節,錯誤消息是「無效的JSON原語:採取。」 – user1147941 2014-12-02 21:14:25