RadAjaxManager won't work with RadioButtonList

2 posts, 0 answers
  1. ck
    ck avatar
    28 posts
    Member since:
    Mar 2013

    Posted 19 Dec 2013 Link to this post

    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?
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 21 Dec 2013 Link to this post

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