OnCheckedChanged callback not firing

2 posts, 0 answers
  1. Mike
    Mike avatar
    3 posts
    Member since:
    Oct 2011

    Posted 23 Jan 2012 Link to this post

    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();
    }
  2. Mike
    Mike avatar
    3 posts
    Member since:
    Oct 2011

    Posted 23 Jan 2012 Link to this post

    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>
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top