新建MVC项目,页面js中
var productView = new wijmo.data.AjaxDataView("home/GetPeople", {
pageSize: 10,
ajax: { crossOrigin: true }
}); 向homecontroller中GetPeople请求数据,后台代码如下
public JsonResult GetPeople()
{
List<atron> people= new List<atron>
{
new Patron{ID=1,Name="Tom",Country="美国",Age=21,Sex=true,Birthday=DateTime.Parse("1994-01-01"),CountryID=1},
new Patron{ID=2,Name="Jerry",Country="英国",Age=23,Sex=true,Birthday=DateTime.Parse("1992-01-01"),CountryID=2},
new Patron{ID=3,Name="Jack",Country="英国",Age=25,Sex=true,Birthday=DateTime.Parse("1990-01-01"),CountryID=2},
new Patron{ID=4,Name="Lucy",Country="美国",Age=21,Sex=false,Birthday=DateTime.Parse("1994-01-01"),CountryID=1},
new Patron{ID=5,Name="张三",Country="中国",Age=22,Sex=true,Birthday=DateTime.Parse("1995-01-01"),CountryID=3},
new Patron{ID=6,Name="李四",Country="中国",Age=21,Sex=true,Birthday=DateTime.Parse("1994-01-01"),CountryID=3},
new Patron{ID=7,Name="李颖",Country="中国",Age=21,Sex=false,Birthday=DateTime.Parse("1994-01-01"),CountryID=3},
};
return Json(people, JsonRequestBehavior.AllowGet);
}
无法显示那里写错了 |
|