OnCheckedChanged Not Firing?

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;
}
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top