To maintain the checkbox for refresh the grid?

Hi,
To maintain the checkbox after data refresehed. So i have get the checkbox and set into grid reload time.
below code i have setcookie to get the checked value
mygrid.attachEvent(“onCheck”, function (rId, cInd, state) {
var colNum = mygrid.getColumnCount();

        for (i = 0; i < colNum; i++) {
            colLabel = mygrid.getColLabel(i);
            if (colLabel == "") {
                var selectColNum = i;
               
            }
        }
        var count = mygrid.getCheckedRows(selectColNum);
        setCookie("CheckedCount", count);
        if (count != "") {
            if (count.split(',').length == mygrid.getRowsNum()) {
                $("#gridbox input:checkbox").attr('checked', 'checked');
            }
            else {
                $("#gridbox input:checkbox").removeAttr('checked');
            }
        }
        else {
            if (count == "" && mygrid.getRowsNum() == 1) {
                $("#gridbox input:checkbox").removeAttr('checked');
            }
        }
    });

After then, I retain the value, when refresh the data.
var CheckedCount0 = getCookie(“CheckedCount”);
if(CheckedCount0 != undefined)
{

     mygrid.setCheckedRows(CheckedCount0 ,1);
      eraseCookie("CheckedCount0");
   }

But i got script error mess, I made mistake for to set ‘colindex’ value?. Because i get the value for row id value.
I need help,

According to your code:

var count = mygrid.getCheckedRows(selectColNum); //count - is a list of Ids of all rows with checked exCell in specified column setCookie("CheckedCount", count); ... var CheckedCount0 = getCookie("CheckedCount"); mygrid.setCheckedRows(CheckedCount0 ,1); // here CheckedCount0 should be the index of the column