I seem to be having an issue getting the event handler for a group of dynamic checkboxes. The code is posted here. I thought this would be pretty straight forward, the checkboxes do not appear in a repeater, datagrid, etc. They appear in a table which is located inside a div which positioned in the center of the screen. Any help would greatly appreciated.
foreach (SelectAssignedRolesByUserResult role in assignedRoles)
{
CheckBox cb = new CheckBox();
cb.ID = string.Format("CheckBox_{0}_{1}", role.role_nm, role.role_id);
cb.Text = role.role_nm;
cb.Attributes.Add("role_id", role.role_id.ToString());
cb.Attributes.Add("assigned_role_id", role.assigned_role_id.ToString());
cb.Checked = (role.assigned_role_id > 0);
cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
TableCell cell = new TableCell();
TableRow row = new TableRow();
cell.Controls.Add(cb);
row.Cells.Add(cell);
TableAssignedRoles.Rows.Add(row);
}