function AddRemoveValues(oChk)
{
if(oChk.checked)
Form1.TextBox1.value +=oChk.value + "," ;
else
Form1.TextBox1.value = Form1.TextBox1.value.replace(oChk.value+",","");
}
foreach (DataGridItem item in dg_Message_Details.Controls[0].Controls)
{
if (item.ItemType == ListItemType.Footer)
{
CheckBox chkAll=(CheckBox)item.FindControl("ckb_Select_All");
System.Text.StringBuilder strScript = new System.Text.StringBuilder("<script language='java-script'> /n");
strScript.Append(" function checkStatus() { /n");
strScript.Append(" var bAll = true; /n");
strScript.Append(" bAll = document.all('" + chkAll.ClientID + "').checked; /n");
strScript.Append("if(bAll){/n");
strScript.Append(" Form1.TextBox1.value = 0; /n");
strScript.Append("}/n");
for(int i=0; i<dg_Message_Details.Items.Count ; i++)
{
strScript.Append(" document.all('" + dg_Message_Details.Items[i].Cells[0].FindControl("chkSelect").ClientID + "').checked = !bAll; /n");
}
for(int i=0;i<dg_Message_Details.Items.Count;i++)
{
strScript.Append(" document.all('" + dg_Message_Details.Items[i].Cells[0].FindControl("chkSelect").ClientID + "').click(); /n");
}
strScript.Append(" } /n");
strScript.Append("</script> /n");
if(!Page.IsClientScriptBlockRegistered("checkStatus"))
Page.RegisterClientScriptBlock("checkStatus",strScript.ToString());
chkAll.Attributes.Add("onclick","checkStatus()");
return;
}
}