Check all function for Datagrids
By Jamsi • Dec 1st, 2006 • Category: ASP.NETI had the need to create a datagrid check all function, similar to those that you see in yahoo, gmail, hotmail etc.
My Datagrid looked like this;
With the datagrid code above, make sure you modify the jsSelectAll parameters!
1st var: The name of your datagrid (In my example, dgList)
2nd var: The name of your check all checkbox
I used a javascript function that loops through all the checkboxes within the datagrid and selects/de-selects.
function jsSelectAll(datagridID, checkallID)
{
var obj = document.getElementById(datagridID).all.tags("input");
var blCheck = true;
var chk = document.getElementById(checkallID);
if (chk.checked == true)
blCheck=true;
else
blCheck=false;
for (var i=0; i
obj[i].checked = blCheck;
}
}
}
No related posts.
FREE NEWSLETTER -> Want Tech Tips Sent Straight to your Inbox?
Grab our Newsletter to Ensure your PC is Running Smooth!
Jamsi is currently studying a full time Bachelor of Computer/Business degree and working part time as an Internet Security Consultant.
Email this author | All posts by Jamsi























