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

RadAjaxManager won't work with RadioButtonList

1 Answer 130 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
ck
Top achievements
Rank 1
ck asked on 19 Dec 2013, 10:54 AM
Hi,

I've posted about this issue a couple of times but never got an asnwer. well i finally found the time to look into it.
I have the following 

telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerPRoxy1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnAcceptReject">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnlControls" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<asp:HiddenField runat="server" ID="hdnEditedLanguageId" />
<asp:Panel runat="server" ID="pnlAcceptReject">
    <asp:RadioButtonList runat="server" ID="btnAcceptReject" RepeatDirection="Horizontal" CssClass="checkboxlist borderless" ValidationGroup="data" AutoPostBack="true" OnSelectedIndexChanged="radioButtonList_SelectedIndexChanged">
        <asp:ListItem Text="The edition is hereby validated for conformity to standards" Value="0" Selected="True"></asp:ListItem>
        <asp:ListItem Text="The edition does not meet standards and still has to be reviewed" Value="1"></asp:ListItem>
    </asp:RadioButtonList>
    <asp:RequiredFieldValidator ID="vldAcceptReject" ControlToValidate="btnAcceptReject" runat="server" CssClass="text-error" Text="please check an option" ValidationGroup="data"></asp:RequiredFieldValidator>
</asp:Panel>

a RadioButtonList inside a user control, inside a repeater on the page. all fine.
when the radiobutton selection changes, a FULL postsback is performed. i don't want that, i need an ajax postback.
so, got my hands dirty, on the javascript side, i got a reference to the ajax manager and i tried triggering the ajax myself

var mgr=$find('ctl00_ctl00_ContentPlaceHolder1_RadAjaxManager1');
//ContentPlaceHolder1_BookEditions_rptEditableEditions_BookEditionCompletion_0_btnAcceptReject_0_1_0 is the
//id of the radio button input control
mgr.ajaxRequestWithTarget('ContentPlaceHolder1_BookEditions_rptEditableEditions_BookEditionCompletion_0_btnAcceptReject_0_1_0','');

and it worked, i got an ajax call but pnlControls, the panel supposed to be the control to update, does not get refreshed( i am basically disabling/enabling controls based on what button is checked).

This seemed a simple two liner thing to implement but it's turning out to be quite complicated, anyone has an idea how to do it?

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 21 Dec 2013, 08:21 AM
Hello Chad,

What you have found is a known bug in .NET with RadioButtonList inside a Repeater. If you test the same scenario with ASP UpdatePanel instead of RadAjaxManager or RadAjaxPanel, the same behavior would be observed.

Notwithstanding, setting the ClientIDMode of the RadioButtonList explicitly to "AutoID" should fix the issue you are experiencing:
<asp:RadioButtonList runat="server" ID="btnAcceptReject" RepeatDirection="Horizontal" CssClass="checkboxlist borderless" ValidationGroup="data"
    AutoPostBack="true" OnSelectedIndexChanged="btnAcceptReject_SelectedIndexChanged" ClientIDMode="AutoID">
    <asp:ListItem Text="The edition is hereby validated for conformity to standards" Value="0" Selected="True"></asp:ListItem>
    <asp:ListItem Text="The edition does not meet standards and still has to be reviewed" Value="1"></asp:ListItem>
</asp:RadioButtonList>

Please give this a try and see if it solves the issue in your project.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
ck
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or