I have an asp.net core razor page app im trying to make an edit page I would like to add a Telerik grid to bind to a list of objects that I have declared as a bind property. The Grid is displaying great but when the form posts back I want the grid to modelbind to the list and pass back in the new records, changed records, and delated actions done in the grid. This is not happening and if I use the bind property or pass the parameter on the onpost I can't get the grid values passed back.
In the code behind
public class HowToUseSteps
{
public int Id { get; set; }
public string Steptext { get; set; }
}
[BindProperty]
public List<HowToUseSteps> _Steps { get; set; }
in the cshtml
<form method="post">
@(Html.Kendo().Grid(Model._Steps)
.Name("HowToUseSteps")
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Columns(columns =>
{
columns.Bound(column => column.Id).Title("Id").Width(100);
columns.Bound(column => column.Steptext).Title("Step");
columns.Command(command => command.Destroy()).Width(150);
}
)
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(true)
)
<button type="submit" class="btn btn-success">Save</button>
</form>
I know i can call separate on change on delete events on the grid. but i was hoping to use databinding on a postback instead. any help would be appricated.
Thanks
Ross