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

The RadAjaxManager do not fire postback with RadioButtonList

16 Answers 316 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 1
Ricky asked on 07 Jan 2008, 03:21 AM
Hi, I drop a RadioButtonList and set its default select index to 0. In normal postback (with RadAjaxManager) mechanism, everything goes well. But if I use RadAjaxManager to instruct it to upload another Control, selecting the first option will not fire postback, while selecting others goes normally. The code snippet is as follows:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="TimeOption_RadioList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Chart1" />
                </UpdatedControls>
            </telerik:AjaxSetting>

 <asp:Panel ID="filterRadio_Panel" runat="server"  DefaultButton="filterSubmit_Btn">
     <asp:RadioButtonList ID="TimeOption_RadioList" runat="server" RepeatDirection="Horizontal"
     OnSelectedIndexChanged="TimeOption_RadioList_SelectedIndexChanged"
     AutoPostBack="True" DataSource='<%#getTimeOptions() %>' DataTextField="key" DataValueField="value" OnDataBound="TimeOption_RadioList_DataBound" >

     </asp:RadioButtonList>
 </asp:Panel>


Is this a common bug?

Regards,
Ricky.

16 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 07 Jan 2008, 11:48 AM
Hi Ricky,

We could not reproduce the problem on our end. Find attached a sample project using your code. We would appreciate it if you modify it so that it exhibits the abnormality you have encountered.

Looking forward to your reply.

All the best,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 1
answered on 07 Jan 2008, 03:39 PM
Simply add Selected attribute to the first item, you will observe what I mentioned.
               
<asp:ListItem Selected="True">111</asp:ListItem>

Ricky.
0
Steve
Telerik team
answered on 09 Jan 2008, 12:47 PM
Hello Ricky,

This is a known problem, which is caused by the fact that setting Selected=true, changes the rendering for that item and it no longer attaches onclick attribute for it. To workaround this weird problem, you can set the wrapping asp:Panel as the initiator and updated controls instead:

  <asp:Panel ID="filterRadio_Panel" runat="server" DefaultButton="Button1">
            <asp:RadioButtonList ID="TimeOption_RadioList" runat="server" RepeatDirection="Horizontal"
                OnSelectedIndexChanged="TimeOption_RadioList_SelectedIndexChanged" AutoPostBack="True">
                <asp:ListItem Selected="True">111</asp:ListItem>
                <asp:ListItem>222</asp:ListItem>
                <asp:ListItem>333</asp:ListItem>
                <asp:ListItem>444</asp:ListItem>
            </asp:RadioButtonList>
            <asp:Button ID="Button1" runat="server" />
            <asp:Label ID="Label1" runat="server"></asp:Label>
        </asp:Panel>

Hope this helps.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 1
answered on 09 Jan 2008, 01:03 PM
Strange enough. Could you provide me the articles or references about this issue?

Appreciate very much.
Ricky.
0
Steve
Telerik team
answered on 09 Jan 2008, 01:49 PM
Hi Ricky,

We have not yet documented this one, but I am adding it in our TODO list right now. Thank you for bringing it up -  your Telerik points have been updated. Here is the difference between the selected item and the normal item in the RadioButtonList:

    <table id="RadioButtonList1" border="0">
    <tr>
        <td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="111" checked="checked" /><label for="RadioButtonList1_0">111</label></td>
    </tr><tr>
        <td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="222" onclick="javascript:setTimeout('__doPostBack(\'RadioButtonList1$1\',\'\')', 0)" /><label for="RadioButtonList1_1">222</label></td>
    </tr>
</table>

Notice how the first item is missing the onclick attribute, so the Ajax controls which rely on that cannot handle the event. It would work if you use the parent panel as initiator and updated control as the RadioButtonList postbacks internally on the selected item and this way the request is intercepted on panel level.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 1
answered on 09 Jan 2008, 02:00 PM
Understand the concept.
Thanks for the explanation.

Ricky.
0
Ricky
Top achievements
Rank 1
answered on 10 Jan 2008, 01:50 AM
Hi, if the updated control msut be outside the parent panel, this solution raised another problem, the re-select the first item (default selected one) will trigger normal postback.

Ricky.
0
Steve
Telerik team
answered on 10 Jan 2008, 08:49 AM
Hi Ricky,

Unfortunately there is no straightforward way to resolve this as it is .NET framework problem that is present in MS AJAX as well. Here is how your scenario would look like if using UpdatePanel:

 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <asp:Panel ID="filterRadio_Panel" runat="server" DefaultButton="Button1"
            <asp:RadioButtonList ID="TimeOption_RadioList" runat="server" RepeatDirection="Horizontal" 
                OnSelectedIndexChanged="TimeOption_RadioList_SelectedIndexChanged" AutoPostBack="True"
                <asp:ListItem Selected="True">111</asp:ListItem> 
                <asp:ListItem>222</asp:ListItem> 
            </asp:RadioButtonList> 
            <asp:Button ID="Button1" runat="server" /> 
        </asp:Panel> <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate> 
        <asp:Label ID="Label1" runat="server"></asp:Label></ContentTemplate
            <Triggers> 
                <asp:AsyncPostBackTrigger ControlID="TimeOption_RadioList" /> 
            </Triggers> 
        </asp:UpdatePanel> 

As you can see the Selected ListItem does not fire its event here as well. The only possible reliable solution will be if you use standard RadioButtons grouped in your own "RadioButtonList" which of course would require some amount of logic applied.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 1
answered on 10 Jan 2008, 09:30 AM
Here is a workaround
http://forums.asp.net/p/1015714/1944047.aspx, although not straightforward.

FYI,
Ricky
0
Jeff
Top achievements
Rank 1
answered on 10 Apr 2008, 05:43 AM
I just set the updated controls to point to the RadioButtonList and this seems to work.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="TimeOption_RadioList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Chart1" />
                   <telerik:AjaxUpdatedControl ControlID="TimeOption_RadioList" />
                </UpdatedControls>
            </telerik:AjaxSetting>
0
Doug
Top achievements
Rank 1
Veteran
answered on 08 Jun 2009, 03:33 AM
Jeff's solution solved my problem with this as well.  Thanks Jeff!
0
Nicolaï
Top achievements
Rank 2
answered on 22 Mar 2011, 08:18 AM
Yes, thanks Jeff!
0
Pravin
Top achievements
Rank 1
answered on 17 May 2011, 07:32 AM
Hi,

I am having the same problem. I am using a radio button list in the user control  and rad manager is on the master page. I have added radio button list in asp:panel. User control gets loaded dynamically. How I can add it as "AjaxUpdatedControl" as control id will changed and will be depending on the consumer (the way asp.net generates id...).

Is there any other way to resolve this issue. Let me know.

Thanks,
Pravin.
0
Nicolaï
Top achievements
Rank 2
answered on 18 May 2011, 07:36 AM
Sounds like you need to add ajax settings from code behind..?
RadAjaxManager1.AjaxSettings.AddAjaxSetting(controlID,controlID,LoadingPAnelID)

and perhaps
Dim ram As RadAjaxManager = RadAjaxManager.GetCurrent(Me.Page)
to find the ajaxmanager on the master page.
0
Mathieu
Top achievements
Rank 1
answered on 22 Jul 2011, 09:01 PM
Thanks Jeff. I encountered this problem with RadControls For ASP.NET Ajax Q2 2011, and Jeff's solution works.
0
Doug Beard
Top achievements
Rank 1
answered on 05 Jan 2012, 09:32 PM
Solves the problem with the latest release still, thanks Jeff!
Tags
Ajax
Asked by
Ricky
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ricky
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Doug
Top achievements
Rank 1
Veteran
Nicolaï
Top achievements
Rank 2
Pravin
Top achievements
Rank 1
Mathieu
Top achievements
Rank 1
Doug Beard
Top achievements
Rank 1
Share this question
or