//for getting checked id function GetCheckedRecord() { var Ids = $('input[name=chkres]:checked').map(function () { return $(this).val(); }).toArray(); if (checkval.length > 0) { checkval = checkval + ',' + Ids; } else { checkval = Ids; } // alert(checkval); } // now click on prev button $(".prevPageBtn").on("click", function (e) { e.preventDefault(); GetCheckedRecord(); $('input[name=chkres]').map(function () { var a = ($.inArray($(this).val(), checkval) != -1); $(this).prop("checked", a); }); fetchData(page - 1); }); // fetchData(page - 1); is a function which bind data in to table function fetchData(whichPage) { var request = $.ajax({ url: '@Url.Action("GetJsonResult", "myController")', method: "POST", data: { "page": whichPage } }); request.done(function (data) { $.each(data, function (key, val) { var today = new Date(); var bgClass = (key % 2 == 0) ? "search-result-bg" : ""; var item = '<tr class="' + bgClass + '">'; item += '<td width="15"><input type="checkbox" id=' + val["RecordID"] + ' value=' + val["RecordID"] + ' name="chkres" class="chkres" /> </td>'; item += '<td >' + val["RecordID"] + '</td>'; item += '</tr>'; items.push(item); }); var result = '<div id="loadingOverlay"></div><tr class="search-result-heading">'; result += '<td width="15">Select All<br/><input class=' + 'check_all' + ' type="checkbox" /></td>'; result += '<td >RecordId</td>'; result += '</tr>'; result += items.join(""); $("#dtsResult").html(result); } });} the problem is <pre lang="c#">$('input[name=chkres]').map(function () {var a = $(this).val();} show last pages id's of check box.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)