My code -----------
@page @model NclHome.Pages.Applications.ControlPanel.HrDataManagement.TestModel @Html.AntiForgeryToken() @{ ViewData["Title"] = "HR Data Management"; } <div> <ejs-grid id="Grid" allowPaging="true" load="onLoad" toolbar="@(new List<string> { "Edit","Cancel", "Update" })"> <e-grid-editSettings allowAdding="false" allowDeleting="false" allowEditing="true" allowEditOnDblClick="true" showDeleteConfirmDialog="true"></e-grid-editSettings> <e-data-manager json="@Model.HrDataViewModel.ToArray()" adaptor="RemoteSaveAdaptor" updateUrl="Test?handler=Update"></e-data-manager> <e-grid-pageSettings pageSize="10" pageSizes="@(new[] {"10","50", "100", "All"})" /> <e-grid-columns> <e-grid-column field="EmpId" headerText="EmpId" width="15" allowEditing="false"></e-grid-column> <e-grid-column field="FullName" headerText="Full Name" width="40" allowEditing="false"></e-grid-column> <e-grid-column field="DateOfSuperannuation" headerText="Date Of Superannuation" type="date" format="dd-MM-yyyy" editType="datepickeredit" width="30"></e-grid-column> <e-grid-column field="IsWorking" headerText="IsWorking" displayAsCheckBox="true" type="boolean" editType="booleanedit" width="15"></e-grid-column> </e-grid-columns> </ejs-grid> </div> @section Scripts { <script type="text/javascript"> function onLoad() { this.dataSource.dataSource.headers = [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }]; } </script> }
.cs --------------------------------
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Syncfusion.EJ2.Base; namespace NclHome.Pages.Applications.ControlPanel.HrDataManagement; public class TestModel : PageModel { public List<HrDataViewModel> HrDataViewModel { get; set; } = new List<HrDataViewModel>(); public TestModel() { } public void OnGet() { HrDataViewModel.Add(new HrDataViewModel { EmpId = 3, FullName = "Mr. Santosh Pradhan", DateOfSuperannuation = DateTime.Now.AddDays(-2), IsWorking = true }); HrDataViewModel.Add(new HrDataViewModel { EmpId = 4, FullName = "Mr. Sekhar Pradhan", DateOfSuperannuation = DateTime.Now.AddDays(-3), IsWorking = false }); HrDataViewModel.Add(new HrDataViewModel { EmpId = 5, FullName = "Mr. Deepak Pradhan", DateOfSuperannuation = DateTime.Now.AddDays(1), IsWorking = false }); } public async Task<JsonResult> OnPostUpdateAsync([FromBody] CRUDModel<HrDataViewModel> crudModel) { //update logic Here return new JsonResult(crudModel.Value); } } public class HrDataViewModel { public int EmpId { get; set; } public string FullName { get; set; } public DateTime? DateOfSuperannuation { get; set; } public bool? IsWorking { get; set; } }