Monday, February 2, 2009

CheckBoxList Select All or None Checkboxes

Here is an very easy client-side javascript to check or uncheck all your checkboxes from your CheckBoxList at once:

<script language="javascript" type="text/javascript">
function Select(Select)
for (var n=0; n < document.forms[0].length; n++)
if (document.forms[0].elements[n].type==’checkbox’)
return false;
Select All | None

Just put it at the top of your ASP.NET page and you’re set. It won’t get any easier than that