OnCheckedChanged Not Firing?

  • Thread starter Thread starter writebrent
  • Start date Start date
W

writebrent

Odd thing: if I check the checkbox, the code works fine. If I uncheck
the checkbox, I get nothing, not even the "Executed" that's supposed to
show up (as you'll see in the code).

Thanks for any help!

-Brent

On the page I have:

===================
<asp:CheckBox ID="cbSelectAll" AutoPostBack=true
OnCheckedChanged="selectAll" runat=server />

(plus a repeater named "repMsgList")
===================

The code that's supposed to execute:

===================

void selectAll(Object Sender, EventArgs e)
{
Response.Write("Executed");
CheckBox cMain = (CheckBox)Sender;
bool cbControl = cMain.Checked ? true : false;

foreach (RepeaterItem ri in repMsgList.Items)
{
if (ri.ItemType == ListItemType.Item || ri.ItemType ==
ListItemType.AlternatingItem)
{
CheckBox cb = (CheckBox)ri.FindControl("cb");
cb.Checked = cbControl ? true : false;
}
}

}
 
Back
Top