Javascript Function for Select All CheckBox functionality..
<script language="javascript" type="text/javascript">
function SelectAll(CheckBoxControl)
{
var ctrlName;
if (CheckBoxControl.id=='chkAllLocation')
{
ctrlName="chkLocations";
}
if (CheckBoxControl.checked == true)
{
var i;
for (i=0; i < document.forms[0].elements.length; i++)
{
if ((document.forms[0].elements[i].type == 'checkbox') &&
(document.forms[0].elements[i].name.indexOf('grdLocation') > -1) )
{
var str = new String(document.forms[0].elements[i].name);
str = str.match(ctrlName);
if (str!=null)
{
if (str.length > 0)
document.forms[0].elements[i].checked = true;
}
}
}
}
else
{
var i;
for (i=0; i < document.forms[0].elements.length; i++)
{
if ((document.forms[0].elements[i].type == 'checkbox') &&
(document.forms[0].elements[i].name.indexOf('grdLocation') > -1))
{
var str = new String(document.forms[0].elements[i].name);
str = str.match(ctrlName)
if (str!=null)
{
if (str.length>0)
document.forms[0].elements[i].checked = false;
}
}
}
}
}
</script>
CS CODE
---------------------------------------------------------------------
<radg:GridTemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkLocations" runat="server" AutoPostBack="false" EnableViewState="True" />
</ItemTemplate>
<HeaderTemplate>
<input type="checkbox" id="chkAllLocation" onclick="SelectAll(this);"/>Copy?
</HeaderTemplate>
<ItemStyle Width="15%" />
</radg:GridTemplateColumn>