<script language="javascript" type="text/javascript">
function CheckUncheck(chk1, chk2) {
var chkbox1 = document.getElementById(chk1);
var chkbox2 = document.getElementById(chk2);
chkbox2.checked = !chkbox1.checked;
}
</script>
<asp:checkbox id="CheckBox1" runat="server" />
<asp:checkbox id="CheckBox2" runat="server" />
Here is the code behind:
if (!IsPostBack)
{
CheckBox1.Attributes.Add("onclick", "CheckUncheck('" + CheckBox1.ClientID + "','" + CheckBox2.ClientID + "');");
CheckBox2.Attributes.Add("onclick", "CheckUncheck('" + CheckBox2.ClientID + "','" + CheckBox1.ClientID + "');");
}