Well, actually it should work. Because I am writing something in my code and it worked. It seems you need to check your javascript code just by changing it with alert ('hello');
foreach (ListItem item in CheckBoxList1.Items) { item.Attributes.Add("onchange", "alert('hello')"); }
This is my simple code and it works.
source share