本地IIS已安装WebAPI。这是asp.net MVC控制器:
namespace MvcApplication3.Controllers
{
public class AddressesController : ApiController
{
public IEnumerable<Address> GetAllddresses()
{
return MvcApplication3.Models.DatabaseAccess.getAddresses();
}
}
}
这是Json返回的:
[{"Id":57638,"Address_1":"1226 S STATE ST","Address_2":"","Zip":60605},
{"Id":57639,"Address_1":"1240 S STATE ST","Address_2":"","Zip":60605}]
这是网格:
var AddressList = kendo.data.Model.define({
fields: {
Id: "Id",
Address_1: "Address_1",
Address_2: "Address_2",
Zip: "Zip"
}
});
$("#grid2").kendoGrid({
dataSource: {
transport: {
read: {
url: "http://localhost/api/addresses"
dataType: "jsonp"
}
},
Schema: {
model: AddressList
}
}
});
问题:网格无法绑定到数据