Sunday, January 22, 2012

Check checkbox only in Repeater not outside of this control


This is the code for finding particular checkbox in repeater only .it will leave the checkboxes which  outside repeater  of the page.I hope it will do what you want exactly ....enjoy coding....!!!

function checkAll(cb) {
        var TargetBaseControl = document.getElementById('pnlData');
        var TargetChildControl = "chkisPassout";

       var ctrls = document.getElementsByTagName('input');
     
        for (var i = 0; i < ctrls.length; i++)
          {
              var cbox = ctrls[i];
              if (cbox.type == "checkbox" && cbox.id.indexOf(TargetChildControl,0) >= 0)
            {
                cbox.checked = cb.checked;
            }
        }
    }