Wednesday, October 12, 2011

Find any Control in Repeater using Javascript

I used Javascript function to check count of checkboxes into repeater which are checked.And on that count I performed some action on it on my client side perfomance.
function checkAll(cb)
{
var ctrls = document.getElementsByTagName('input');
var count=0;
for (var i = 0; i < ctrls.length; i++)
{
var cbox = ctrls[i];
if (cbox.type == "checkbox")
{

if(cbox.checked)
{
count++;

}
//cbox.checked = cb.checked;
}
}
}

Call this function on aspx contol

asp:CheckBox ID="chkPaper" runat="server" onclick="return checkAll(this)"
enjoy coding...

No comments:

Post a Comment