0

本地 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
        }
    }
});            

问题:网格无法绑定数据

4

0 回答 0