OnCheckedChanged Not Firing?

Discussion in 'ASP .Net' started by writebrent@gmail.com, Jul 4, 2006.

  1. Guest

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

    }
    , Jul 4, 2006
    #1
    1. Advertising

  2. check if it going in Page_LOad event and PostBack part is working....

    Raj

    "" wrote:

    > 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;
    > }
    > }
    >
    > }
    >
    >
    =?Utf-8?B?UmFq?=, Jul 5, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Homa
    Replies:
    3
    Views:
    14,812
    nchavan
    Jul 23, 2009
  2. Maziar Aflatoun

    asp checkbox checking for OnCheckedChanged value

    Maziar Aflatoun, Sep 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    23,187
    radu_m
    Dec 29, 2008
  3. Danielle
    Replies:
    1
    Views:
    2,758
    Munna
    Jun 8, 2008
  4. arby

    Checkbox in DataGrid Not Firing OnCheckedChanged events.

    arby, Jan 30, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    500
    Alvin Bruney [MVP]
    Jan 31, 2004
  5. Hitesh Jain

    oncheckedchanged event is not firing everytime on checkbox

    Hitesh Jain, Oct 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    1,401
    Robert Koritnik
    Oct 15, 2004
Loading...

Share This Page