I'm using an MVC grid on a page which contains a checkbox column. It's defined as follows:
columns.Bound(p => p.IsActive).Title("Active?").ClientTemplate("<input type='checkbox' #= IsActive ? checked='checked' : '' # />").Width(80);
I have JavaScript code that captures a change in the value of the checkbox and sets the underlying data item to true or false as follows:
$("#grid .k-grid-content").on("change", "input#IsActive", function (e) {
var grid = $("#grid").data("kendoGrid");
var checked = $(this).is(':checked');
var col = $(this).closest('td');
dataItem = grid.dataItem($(e.target).closest("tr"));
dataItem.set(grid.columns[col.index()].field, checked);
});
All this works exactly as it should. Except when the user saves the row and my controller Update method is called, the value of the checkbox is always returned as false, even if the checkbox is checked. I have verified that the value of 'checked' above is true and the underlying data item is being set to true. But a false is always returned to the controller method.