Code - Chekbox in Datagrid (All Operations)
Code - Chekbox in Datagrid (All Operations)
{
var frm = document.forms[0];
// loop through all elements
for (i=0;i< frm.length; i++)
{
// look for our header template's checkbox
if (idval.indexof ('checkall') != -1)
{
// check if main checkbox is checked, then select or deselect datagrid checkboxes
if(chkval == true)
{
frm.elements[i].checked = true;
}
else
{
frm.elements[i].checked = false;
}
// work here with the item template's multiple checkboxes
}
else if (idval.indexof ('deletethis') != -1)
{
// check if any of the checkboxes are not checked, and then uncheck top select all
checkbox
if (frm.elements[i].checked == false)
{
frm.elements[1].checked = false;
//uncheck main select all checkbox
}
}
}
}
function confirmdelete (frm)
{
// loop through all elements
for (i=0; i<frm.length; i++)
{
// look for our checkboxes only
if (frm.elements[i].name.indexof("deletethis") !=-1)
{
// if any are checked then confirm alert, otherwise nothing happens
if(frm.elements[i].checked)
{
return confirm ('are you sure you want to delete your selection(s)?')
}
}
}
}