I have implemented a simple Kendo grid in ASP .Net Core which should bind the data on DataSoruce Read request. In actual it is not binding data in read request but binds the data whenever i click on 'refresh' icon under pagination. Below is my code -
<div class="grid-container">
@(Html.Kendo().Grid<CAMPv2.Models.AutoPoco.Role>()
.Name("RolesGrid")
.Columns(columns =>
{
columns.Bound(c => c.Name);
columns.Bound(c => c.NormalizedName);
columns.Bound(c => c.Description);
columns.Bound(c => c.Status);
})
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("GetRoles", "Role"))
)
)
</div>
Below is code behind -
[HttpPost]
public IActionResult GetRoles([DataSourceRequest] DataSourceRequest request)
{
List<Role> _lrolePermissionDetails = _tableOperations.GetAll<Role>(ApplicationConstants.CONNECTOR_AUTOPOCOAUTH, "Role", _loggingService).ToList();
return Json(_lrolePermissionDetails.ToDataSourceResult(request));
}
Please let me know what i am missing here.
Thanks,
Naga