| <form> @Html.EJS().Button("refresh").Content("Refresh").Render() @Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col => { col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("150").Add(); ... }).AllowFiltering().EditSettings(e => e.AllowEditing(true).AllowDeleting(true)).Render() </form> <script> document.getElementById("refresh").addEventListener("click", () => { var grid = document.getElementById("Grid").ej2_instances[0]; $.ajax({ url: "/Home/Data", type: "POST", datatype: "json", contentType: "application/json; charset=utf-8", data: JSON.stringify({ gid: JSON.stringify(grid.dataSource) }), success: function (result) { debugger; } }); }) </script> [HomeController.cs] public ActionResult Data(string gid) { return Json(gid, JsonRequestBehavior.AllowGet); } |