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

RadAjaxManager and RadioButtonList

2 Answers 170 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Regula
Top achievements
Rank 1
Regula asked on 15 Jul 2010, 03:01 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 15 Jul 2010, 04:02 PM
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
0
Regula
Top achievements
Rank 1
answered on 15 Jul 2010, 04:05 PM
Bingo!

Thanks Tsvetoslav!

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

Tags
Ajax
Asked by
Regula
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Regula
Top achievements
Rank 1
Share this question
or