| <ej-drop-down-list id="dropdown" datasource="ViewBag.datasource" enable-incremental-search="true" case-sensitive-search="true"> <e-drop-down-list-fields text="Text" /> </ej-drop-down-list> <ej-button id="btn" text="update grid" click="click" /> <ej-grid id="Grid" datasource=ViewBag.parent allow-paging="true" > <e-datamanager url="/Grid/Data" adaptor="UrlAdaptor" /> ............. </ej-grid> <script type="text/javascript"> function click(args) { var gridObj = $("#Grid").data("ejGrid"); gridObj.option({ query: new ej.Query().addParams('ID', $("#dropdown").ejDropDownList("getSelectedValue")) }); gridObj.refreshContent(); } </script> |
| namespace SyncfusionASPNETCoreApplication2.Controllers { public partial class GridController : Controller { public object JsonRequestBehavior { get; private set; } public ActionResult GridFeatures() { if (emp.Count == 0) BindParentData(); ViewBag.parent = emp; BindChildData(); ViewBag.child = emp1; ........... ViewBag.datasource = DropDownData; return View(); } public JsonResult Data([FromBody]Test dataObj) { IEnumerable data = emp1; if (dataObj.ID != null) data = data.Cast<Orders>().Where(em => em.ShipCity == dataObj.ID).ToList(); int count = data.Cast<Orders>().Count(); DataOperations dp = new DataOperations(); dp.PerformSkip(data, dataObj.Skip); dp.PerformTake(data, dataObj.Take); return Json(new { result = data, count = count }); } public class Test : DataManager //inherit the class to show age as property of DataManager { public string ID { get; set; } } public class GridExtended : GridProperties { [DefaultValue(true)] [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] [JsonProperty("includeChildExport")] public bool IncludeChildExport { get; set; } } } } |