@{ int id = 10002; } @(Html.EJ().Grid<object>("Grid") .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor").BatchURL("/Home/Update")) .Query("new ej.Query().addParams('organisationID', " + "'" + id + "'" + ")") .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .Columns(col => { col.Field("OrderID").IsPrimaryKey(true).HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("Freight").HeaderText("Freight").EditType(EditingType.Numeric).Format("{0:C}").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
public ActionResult DataSource(DataManager dm, int organisationID) { var DataSource = OrderRepository.GetAllRecords(); DataResult result = new DataResult(); result.result = DataSource.Skip(dm.Skip).Take(dm.Take).ToList(); result.count = DataSource.Count(); return Json(result, JsonRequestBehavior.AllowGet); |
@{
int id = 10002;
}
Following
@{
int id = int.Parse(Request.QueryString["xxxx"]);
}
@{ int id = int.Parse(Request.QueryString["id"]); }
@(Html.EJ().Grid<object>("Grid") .Datasource(ds => ds.URL("/Home/DataSource").Adaptor("UrlAdaptor").BatchURL("/Home/Update")) .Query("new ej.Query().addParams('organisationID', " + "'" + id + "'" + ")") .AllowPaging() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); items.AddTool(ToolBarItems.Update); items.AddTool(ToolBarItems.Cancel); }); }) .Columns(col => { col.Field("OrderID").IsPrimaryKey(true).HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("Freight").HeaderText("Freight").EditType(EditingType.Numeric).Format("{0:C}").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();
}) |