public ActionResult ChildList(int productId, SearchModel searchModel) { StoreRepository rep = new StoreRepository(); List<Store> stores = rep.GetByProductId(productId); var model = stores.AsQueryable(); return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet); }
public ActionResult LocalData() { StoreRepository repository = new StoreRepository(); List<Store> stores = repository.ListAll(); ViewData["GridDataSource"] = stores; return View(); }
/* Notice the List methid accepts an additional * SearchParameter parameter - this is achieved using the - * Html.BuildQuery method used in the view Grid declaration */ public ActionResult List(SearchParameter searchP, SearchModel searchModel) { StoreRepository repository = new StoreRepository(); List<Store> stores = repository.ListAll(); var model = stores.AsQueryable(); return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet); }