0
我傳遞的信息從控制器到視圖,像這樣:綁定劍道DataGrid中使用jQuery
return View(data);
我怎樣才能在視圖中訪問這些數據,所以數據綁定到KendoDataGrid? 我有以下代碼:
@model IEnumerable<MyCustomerModel>
<div id="StatementGrid"></div>
<script>
$(document).ready(function() {
var lines = [{ TransactionDate: "01/01/2014", TransactionNumber: "001" }];//this works
var lines2 = @model //How to pass the model information here?
var grid = $("#StatementGrid").kendoGrid({
columns: [
{ field: "TransactionDate", title: "Date" },
{ field: "TransactionNumber", title: "Transaction Number" }
],
dataSource: {
data:lines
//data:lines2 //this does not work
}
});
});
</script>
謝謝肖恩,這個工作。你可以詳細說明爲什麼這種方法不是一種可接受的方法嗎?是否因爲它不允許在網格上進一步分頁/排序/過濾? – Ben