RadioButtonList used with RadAjaxManager always perform full page postback

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

    Posted 05 Nov 2013 Link to this post

    I have an ASP.Net RadioButtonList control with AutoPostBack set to true and a server side handler for the SelectedIndexChanged event.

    <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>

    <telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerPRoxy1">
    <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="btnAcceptReject">
    <UpdatedControls>
    <telerik:AjaxUpdatedControl ControlID="pnlControls" />
    </UpdatedControls>
     </telerik:AjaxSetting><br></AjaxSettings>

    pnlControl is a panel on the page containing controls that will be enabled/disabled depending on which radio button was checked.

    the RadAjaxManager never seems to catch the submit event, the above always performs a full postback when one of the radio button of the group is clicked.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2013 Link to this post

    Hi ck,

    Unfortunately I couldn't replicate the issue at my end. Here is the sample code I tried which works as expected.

    MasterPage ASPX:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    ......

    Content Page ASPX:
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnAcceptReject">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlControls" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true">
            <asp:ListItem Text="Item1" Selected="True">
            </asp:ListItem>
            <asp:ListItem Text="Item2">
            </asp:ListItem>
        </asp:RadioButtonList>
        <asp:Panel ID="Panel1" runat="server">
            <asp:Label ID="Label1" runat="server">
            </asp:Label>
        </asp:Panel>
    </asp:Content>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ck
    ck avatar
    28 posts
    Member since:
    Mar 2013

    Posted 05 Nov 2013 Link to this post

    well if it helps, both btnAcceptReject and pnlControls are inside a user control
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2013 Link to this post

    Hi ck,

    Please have a look into the sample code in which the RadioButtonList and Panel are inside a UserControl.

    ASPX:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <uc1:ajaxmanagerproxy ID="ajaxmanagerproxy1" runat="server" />
    ...

    UserControl :
    <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadioButtonList1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true">
        <asp:ListItem Text="Item1" Selected="True">
        </asp:ListItem>
        <asp:ListItem Text="Item2">
        </asp:ListItem>
    </asp:RadioButtonList>
    <asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="Label1" runat="server">
        </asp:Label>
    </asp:Panel>

    Thanks,
    Princy.
  6. ck
    ck avatar
    28 posts
    Member since:
    Mar 2013

    Posted 06 Nov 2013 Link to this post

    Ok i am posting my code, if you guys can have a look

    The control's ascx file is below

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BookEditionCompletionControl.ascx.cs" Inherits="ITN.Controls.ImdisList.BookEditionCompletionControl" %>
    <telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerPRoxy1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnAcceptReject">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlControls" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnTranslationFinalized">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlControls" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <asp:HiddenField runat="server" ID="hdnEditedLanguageId" />
    <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 runat="server" ID="pnlEditionTranslated" CssClass="checkboxlist" Visible="false">
        <asp:RadioButtonList runat="server" ID="btnTranslationFinalized" RepeatDirection="Horizontal" CssClass="checkboxlist borderless" ValidationGroup="data" AutoPostBack="true" OnSelectedIndexChanged="radioButtonList_SelectedIndexChanged">
            <asp:ListItem Text="Edition translation is hereby finalized." Value="0" Selected="True"></asp:ListItem>
            <asp:ListItem Text="Translation is still underway" Value="1"></asp:ListItem>
        </asp:RadioButtonList>
    </asp:Panel>
    <asp:Panel runat="server" ID="pnlControls">
        <table class="table table-bordered level1">
            <tbody>
                <tr>
                    <td class="label-column">
                        <span>Edition Title</span> <span class="text-error">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="txtTitle" placeholder="The title in the specified edition language" data-description="Title of the edition" CssClass="compact-field required-input" runat="server" Width="1000" MaxLength="400" required="title required"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldTitle" ControlToValidate="txtTitle" runat="server" CssClass="text-error" Text="title required" ValidationGroup="data"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="label-column">
                        <span>Registration Date</span> <span class="text-error">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="dateIssue" placeholder="issue date" CssClass="compact-field datepicker readonly-enabled-looklike" runat="server" Width="100" data-date-format="dd/mm/yyyy" ReadOnly="true"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldIssueDate" runat="server" ControlToValidate="dateIssue" Text="issue date required" ValidationGroup="data" CssClass="text-error"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
      
                    <td class="label-column">
                        <span>Marketing Blurb</span> <span class="text-error">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="txtMarketingBlurb" placeholder="marketing blurb" CssClass="compact-field required-input" runat="server" Width="1000" MaxLength="400" TextMode="MultiLine" Height="80"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldMarketingBlurb" runat="server" ControlToValidate="txtMarketingBlurb" Text="Abstract of the publication required" ValidationGroup="data" CssClass="text-error"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
      
                    <td class="label-column">
                        <span>Abstract</span> <span class="text-error">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="txtAbstract" placeholder="excerpt of the publication" CssClass="compact-field required-input" runat="server" Width="1000" MaxLength="400" TextMode="MultiLine" Height="80"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldAsbtract" runat="server" ControlToValidate="txtAbstract" Text="Abstract required" ValidationGroup="data" CssClass="text-error"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="label-column">
                        <span>Number Of Pages</span> <span class="text-error star">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="txtPages" placeholder="pages" CssClass="compact-field text-right required-input" runat="server" Width="70" data-type="int" data-min="1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldPages" runat="server" ControlToValidate="txtPages" Text="number of pages required" ValidationGroup="data" CssClass="text-error"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="label-column">
                        <span>Library Id</span> <span class="text-error">*</span>
                    </td>
                    <td class="data-cell">
                        <asp:TextBox ID="txtLibraryId" placeholder="library id" CssClass="compact-field required-input" runat="server" Width="400" MaxLength="10"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldLibraryId" ControlToValidate="txtLibraryId" runat="server" CssClass="text-error" Text="library Id required" ValidationGroup="data"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="label-column">
                        <span>Attached Documents</span>
                    </td>
                    <td class="data-cell">
                        <asp:Panel runat="server" ID="pnlDocumentsHost" CssClass="documents-host">
                            <div>No documents added.</div>
                        </asp:Panel>
                    </td>
                </tr>
            </tbody>
        </table>
      
    </asp:Panel>

    and the handler from the code behind

    protected void radioButtonList_SelectedIndexChanged(object sender, EventArgs e)
            {
                bool accepted = (sender as RadioButtonList).SelectedValue == "0";
                //disable/enable all controls based on whether the user validates or rejects the review
                txtTitle.Enabled = txtPages.Enabled = txtAbstract.Enabled = dateIssue.Enabled = txtLibraryId.Enabled = txtMarketingBlurb.Enabled = accepted;
                if (!accepted)
                    txtTitle.Text = txtAbstract.Text = dateIssue.Text = txtLibraryId.Text = txtMarketingBlurb.Text = txtPages.Text= null;
                vldTitle.Enabled = vldIssueDate.Enabled = vldMarketingBlurb.Enabled = vldAsbtract.Enabled = vldLibraryId.Enabled = vldPages.Enabled = accepted;
            }

    this control is hosted inside another user control called BookEditionsControl

    <asp:Repeater runat="server" ID="rptEditableEditions" OnItemDataBound="rptEditableEditions_ItemDataBound">
                    <ItemTemplate>
                        <div class='bookEditionTab <%# Container.ItemIndex==0? "tab-pane active" : "tab-pane"  %>' id='<%# Eval("Id") %>'>
                            <input type="hidden" id='<%#"hdnLangEditable_"+Eval("Id") %>' value="1" />
                            <uc1:BookEditionCompletionControl runat="server" ID="BookEditionCompletion" WorkMode="<%# WorkMode %>" />
                        </div>
                    </ItemTemplate>
                </asp:Repeater>

    which in turn is inside a master page where the RadAjaxManager is hosted

    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            </telerik:RadAjaxManager>
      
    <uc1:BookEditionsControl runat="server" ID="BookEditions" WorkMode="Edit" />


  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Nov 2013 Link to this post

    Hi ck ,

    I have tried your code unfortunately I couldn't replicate the issue at my end.

    Thanks,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017