BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Index.cshtml <script type="text/javascript"> function doreload(args) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { $("#contentzone").html(this.responseText); } }; xhttp.open("POST", "/Home/Page", true); xhttp.send(); } </script> _homeContent.cshtml @(Html.EJ().Grid<SyncfusionMvcApplication7.Models.ModelT>("GridContainer") … }) ) @Html.EJ().ScriptManager() |
Web.config <appSettings> . . . <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> _layout.cshtml <!DOCTYPE html> <html> <head> . . . . .. <script src="~/Scripts/ej/ej.web.all.min.js"></script> <script src="~/Scripts/ej/ej.unobtrusive.min.js"></script> </head> <body> @RenderBody() @(Html.EJ().ScriptManager()) </body> </html> Index.cshtml <script type="text/javascript"> function doreload(args) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { $("#contentzone").html(this.responseText); ej.widget.init($("#contentzone")); // Initiate control rendering } }; xhttp.open("POST", "/Home/Page", true); xhttp.send(); } </script> |
@(Html.EJ().Grid<SyncfusionMvcApplication7.Models.ModelT>("GridContainer") .Datasource(ds => ds.URL("/home/DataSource").Adaptor("UrlAdaptor")) .Query(queryString) .. .Columns(col => { col.Field("ModelTID").HeaderText("ID").IsPrimaryKey(true).IsIdentity(true).Visible(false).Add(); col.Field("Name").HeaderText("Name").Add(); col.Field("Age").HeaderText("Age").EditType(EditingType.Numeric).Add(); col.Field("Date").HeaderText("Date").Add(); }) ) HomeController.cs public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) { IEnumerable Data = source; Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); if (dm.Where != null && dm.Where.Count > 0) //Filtering { Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Operator); } 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); } |