This is a migrated thread and some comments may be shown as answers.

OnCheckedChanged callback not firing

1 Answer 302 Views
Button
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 23 Jan 2012, 10:43 PM
I have a RadButton with ButtonType=ToggleButton and ToggleType=CheckBox with an associated OnCheckedChanged callback.  My problem is that the callback only fires on the 1st, 4th, 7th, etc. time I click the checkbox.  I would like the callback to fire every time I toggle the check box.  Does anyone know why the callback does not fire every time the checkbox is toggled?  

Note: If I change focus after toggling the checkbox by clicking on another server control, the callback does fire the next time I toggle it even if it's just the 2nd time I toggle it.

Here's my aspx code:
<asp:UpdatePanel ID="UpdatePanel_System" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" EnableViewState="True">
  <div>
    <telerik:RadButton ID="displaySystemAnnouncementsCB" runat="server" Text="Display system announcements to all users at the top of the page"
        ToggleType="CheckBox" OnCheckedChanged="displaySystemAnnouncementsCBCB" ButtonType="ToggleButton">
    </telerik:RadButton>
  </div>
</asp:UpdatePanel>


Here's my callback function:
protected void displaySystemAnnouncementsCBCB(object sender, EventArgs e)
{
    RadButton rb = (RadButton)sender;
    if (rb.Checked)
    {
        configuration.AppSettings.Settings["displaySystemAnnouncements"].Value = "1";
    }
    else
    {
        configuration.AppSettings.Settings["displaySystemAnnouncements"].Value = "0";
    }
    configuration.Save();
}

1 Answer, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 23 Jan 2012, 11:15 PM
After originally posting I noticed my control was inside of an <asp:UpdatePanel> block, so I added the following code and that fixed the problem:

<Triggers>
    <asp:PostBackTrigger ControlID="displaySystemAnnouncementsCB" />
</Triggers>
Tags
Button
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Share this question
or