RadAjaxManager and RadioButtonList

3 posts, 1 answers
  1. Regula
    Regula avatar
    47 posts
    Member since:
    Sep 2005

    Posted 15 Jul 2010 Link to this post

    Hi there,

    I'm running in a strange behaviour.

    I have a RadioButtonList with on two options. When I change it fires a server side event the will hide one panel and show another panel.
    The strange thing is that the event only fires once, ie, after the first SelectedIndexChanged event called the radio button doesn't fire anymore the event...

    Here is an excerpt of the code:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="myRadioBList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panel1" />
                    <telerik:AjaxUpdatedControl ControlID="panel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <asp:RadioButtonList ID="myRadioBList" runat="server" RepeatDirection="Horizontal"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="myRadioBList_SelectedIndexChanged" RepeatLayout="Flow">
                    <asp:ListItem Value="M">M</asp:ListItem>
                    <asp:ListItem Value="C">C</asp:ListItem>
                </asp:RadioButtonList>
     
    <asp:Panel runat="server" ID="panel1"> .... </asp:Panel>
    <asp:Panel runat="server" ID="panel2"> .... </asp:Panel>


    On my code-behind I only have this:

    protected void myRadioBList_SelectedIndexChanged(object sender, EventArgs e)
           {
               if (myRadioBList.SelectedValue == "C")
               {
                   panel1.Visible = true;
                   panel2.Visible = false;
               }
               else
               {
                   panel1.Visible = false;
                   panel2.Visible = true;
               }
           }

  2. Answer
    Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 15 Jul 2010 Link to this post

    Hello Regula,

    Try changing your ajax settings as follows:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="myRadioBList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panel1" />
                    <telerik:AjaxUpdatedControl ControlID="panel2" />
                    <telerik:AjaxUpdatedControl ControlID="myRadioBList" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


    Hope it helps.

    All the best,
    Tsvetoslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Regula
    Regula avatar
    47 posts
    Member since:
    Sep 2005

    Posted 15 Jul 2010 Link to this post

    Bingo!

    Thanks Tsvetoslav!

    Still have a lot to learn about AJAX....

Back to Top