@(Html.EJ().Grid<SyncfusionMvcApplication29.OrdersView>("FlatGrid") .Datasource(ds => ds.URL("/Grid/DataSource").Adaptor("UrlAdaptor")) .AllowPaging() /*Paging Enabled*/ .PageSettings(a => a.PageSize(5)) .Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add(); col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add(); col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add(); })) GridController.cs public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) { IEnumerable Data = new NorthwindDataContext().OrdersViews.ToList(); Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); int count = Data.AsQueryable().Count(); if (dm.Skip != 0) { Data = operation.PerformSkip(Data, dm.Skip); } if (dm.Take != 0) { Data = operation.PerformTake(Data, dm.Take); } return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet); } |