I am not sure what I am missing here, I have a grid that I just want to update, not create or destroy. I thought I had done this correctly, but the save button does not fire my update method on the user controller.
<div id="CampaignGrid">
@(Html.Kendo().Grid<SubCampaign>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.CampaignName);
columns.Bound(c => c.Status).ClientTemplate("<input type='checkbox' value='#= Status #' " +
"# if (Status) { #" +
"checked='checked'" +
"# } #" +
"/>");
})
.ToolBar(toolbar => toolbar.Save())
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource =>
dataSource.Ajax()
.Batch(true)
.Model(model =>
{
model.Id(campaign => campaign.Id);
model.Field(campaign => campaign.CampaignName).Editable(false);
model.Field(campaign => campaign.Status);
})
.Read(read => read.Action("SwitchCampaignRead", "User"))
.Update(update => update.Action("SwitchCampaigns", "User")))
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
</div>
<div id="CampaignGrid">
@(Html.Kendo().Grid<SubCampaign>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.CampaignName);
columns.Bound(c => c.Status).ClientTemplate("<input type='checkbox' value='#= Status #' " +
"# if (Status) { #" +
"checked='checked'" +
"# } #" +
"/>");
})
.ToolBar(toolbar => toolbar.Save())
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource =>
dataSource.Ajax()
.Batch(true)
.Model(model =>
{
model.Id(campaign => campaign.Id);
model.Field(campaign => campaign.CampaignName).Editable(false);
model.Field(campaign => campaign.Status);
})
.Read(read => read.Action("SwitchCampaignRead", "User"))
.Update(update => update.Action("SwitchCampaigns", "User")))
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
</div>