count No of check boxs checked in grid view

Pavanandey
Posted by Pavanandey under JavaScript category on | Points: 40 | Views : 814
function validateGrid()
{
var count=0;
var Obj = getObj('<%=gdvMyTasks.ClientID%>');

for(i=1;i<Obj.rows.length;i++)
{
cell = Obj.rows[i].cells[0]; //assuming check box is in first coloum
for (j=0; j<cell.childNodes.length; j++)
{
if (cell.childNodes[j].type =="checkbox")
{
if( cell.childNodes[j].checked)
{
count =1;
}
}
}
}

if(count==0)
{
alert("Please Select atleast one");
return false;
}
}

Comments or Responses

Login to post response