Jquery 简单的剑道网格实现
我正在尝试用HtmlHelper扩展实现剑道网格 我的控制器类是“Store”,视图是“viewStores”,我正试图使用方法“StoreRead”绑定数据。我正在使用visual studio 2012、.net 4.5以及mvc 4和razor 这是我的密码Jquery 简单的剑道网格实现,jquery,asp.net-mvc,kendo-grid,Jquery,Asp.net Mvc,Kendo Grid,我正在尝试用HtmlHelper扩展实现剑道网格 我的控制器类是“Store”,视图是“viewStores”,我正试图使用方法“StoreRead”绑定数据。我正在使用visual studio 2012、.net 4.5以及mvc 4和razor 这是我的密码 public ActionResult viewStores() { //return View(GetStores()); return View(); } public ActionResult StoreR
public ActionResult viewStores()
{
//return View(GetStores());
return View();
}
public ActionResult StoreRead([DataSourceRequest] DataSourceRequest request)
{
return Json(GetStores().ToDataSourceResult(request));
}
private static IEnumerable<Store> GetStores()
{
var db_store = new AppContext();
return db_store.Stores.Select(store => new Store
{
storeID = store.storeID,
address = store.address,
postcode = store.postcode,
city = store.city,
Country = store.Country
});
}
那么,你的问题是什么?我没有在我的剑道网格表中查看数据,我相信我没有正确绑定数据。。。我只想要剑道网格的简单实现。。。许多人都设法破解了它。。。。我的错误是没有正确绑定数据
@model KendoAspNetBundles.Models.Store
<h2>viewStores</h2>
@(Html.Kendo().Grid<KendoAspNetBundles.Models.Store>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(s => s.storeID);
columns.Bound(s => s.address);
columns.Bound(s => s.postcode);
columns.Bound(s => s.city);
columns.Bound(s => s.Country);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("StoreRead", "Store"))
)
.Pageable()
)
public class Store
{
public int storeID { get; set; }
public string address { get; set; }
public string postcode { get; set; }
public string city { get; set; }
public string Country { get; set; }
}