I have a jqgrid with a checkbox column. when checkbox is pressed i need to update database.
I can retrieve id from my jqgrid, but when I’m sending it further to my controller I retrieve id = null
here is the code in load complete function
var iCol = getColumnIndexByName($(this), 'Aktiv'), rows = this.rows, i,
c = rows.length;
for (i = 0; i < c; i += 1) {
$(rows[i].cells[iCol]).click(function(e) {
var id = $(e.target).closest('tr')[0].id,
isChecked = $(e.target).is(':checked');
alert('clicked on the checkbox in the row with id=' + id +
'\nNow the checkbox is ' +
(isChecked ? 'checked' : 'not checked'));
$.ajax({
mtype: "POST",
url: '@Url.Action("Action")',
data: { actionparameter: id },
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
cache: false
});
;
if
alertshows not null for theidyou should verify your server code. Depend on your configuration you could need to useJSON.stringifymethod from json2.js likeor just do no JSON specific prameters in the
$.ajaxcall.