Issue updating display with code behind using RadAjaxManager AjaxRequest

6 posts, 1 answers
  1. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Feb 2016

    Posted 04 Mar Link to this post

    Hello there,

    I'm having some issues to get my RadAjaxManager AjaxRequest work in my project. Below is my source code.

    • RadAjaxManager configuration

    01.<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    02.    <AjaxSettings>
    03.        <telerik:AjaxSetting AjaxControlID="RadComboBox1">
    04.            <UpdatedControls>
    05.                <telerik:AjaxUpdatedControl ControlID="RadComboBox2" LoadingPanelID="RadAjaxLoadingPanel1" />
    06.                <telerik:AjaxUpdatedControl ControlID="RadComboBox3" LoadingPanelID="RadAjaxLoadingPanel1" />
    07.                <telerik:AjaxUpdatedControl ControlID="RadComboBox4" LoadingPanelID="RadAjaxLoadingPanel1" />
    08.            </UpdatedControls>
    09.        </telerik:AjaxSetting>
    10.        <telerik:AjaxSetting AjaxControlID="RadComboBox2">
    11.            <UpdatedControls>
    12.                <telerik:AjaxUpdatedControl ControlID="RadComboBox4" LoadingPanelID="RadAjaxLoadingPanel1" />
    13.            </UpdatedControls>
    14.        </telerik:AjaxSetting>
    15.    </AjaxSettings>
    16.</telerik:RadAjaxManager>
    17.<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
    18.    Width="75px" >
    19.    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
    20.        style="border: 0;" />
    21.</telerik:RadAjaxLoadingPanel>

    • RadComboBox configuration, same for all of them so I just post one :

    1.<telerik:RadComboBox RenderMode="Classic" ID="RadComboBox1" runat="server" CheckBoxes="true"
    2.    EnableCheckAllItemsCheckBox="true" DataTextField="name" DataValueField="id" AutoPostBack="true"
    3.    OnClientDropDownClosed="ClientCollapsedComboBox">
    4.</telerik:RadComboBox>

    • Javascript used for making AjaxRequest with OnClientDropDownClosed event :

    1.<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    2.    <script type="text/javascript">
    3.        function ClientCollapsedComboBox(sender, eventArgs) {
    4.            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
    5.            ajaxManager.ajaxRequest();
    6.        }
    7.    </script>
    8.</telerik:RadCodeBlock>

    • And finally my AjaxRequest code behind method :

    1.protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    2.{
    3.    RadComboBox4.Items.Clear();
    4.    RadComboBox4.DataBind();
    5.    // doing some work here
    6.}

     

    On closing dropdown the event is correctly fired. So, here come my questions :

    1. While debugging I enter in RadAjaxManager1_AjaxRequest method but the changes made are not displayed on the page.Is there something wrong in my config ?
    2. Except retrieving the id of the element which fired the event and do some switch/case like job in RadAjaxManager1_AjaxRequest method is there another way to do some work based on the element that fired the event ?

    If there is anything unclear with my questions or anything else, please tell me and I'll try to develop.

     

    Regards,

  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 09 Mar Link to this post

    Hi,

    You should add a setting in which the RadAjaxManager itself updates the ComboBox like this:
    .
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
     
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
     
                <UpdatedControls>
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox2" />
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox3"  />
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox4" />
     
                </UpdatedControls>
     
            <telerik:AjaxSetting AjaxControlID="RadComboBox1">
     
                <UpdatedControls>
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox2" LoadingPanelID="RadAjaxLoadingPanel1" />
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox3" LoadingPanelID="RadAjaxLoadingPanel1" />
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox4" LoadingPanelID="RadAjaxLoadingPanel1" />
     
                </UpdatedControls>
     
            </telerik:AjaxSetting>
     
            <telerik:AjaxSetting AjaxControlID="RadComboBox2">
     
                <UpdatedControls>
     
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox4" LoadingPanelID="RadAjaxLoadingPanel1" />
     
                </UpdatedControls>
     
            </telerik:AjaxSetting>
     
        </AjaxSettings>
     
    </telerik:RadAjaxManager>
    Give this a tray and see how it goes.

    Regards,
    Maria Ilieva
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Feb 2016

    Posted 09 Mar in reply to Maria Ilieva Link to this post

    Hi Maria,

    Thank you for your reply.

    I managed to get it working suing your trick. However, I get the same behavior whether I keep the RadComboBox1 and 2 AjaxSettings or not. Everything seems to be working with only the RadAjaxManager1 AjaxSetting you suggested.

    Is there some hidden behavior that still use those two AjaxSettings or are they now just useless regarding the one with RadAjaxManager1 as AjaxControlID ?

    Anyway, thank you for the fix again.

     

    Regards,

    Benjamin.

  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 10 Mar Link to this post

    Hi,

    The setting in which the RadAjaxMnager is Ajax initiator is used only in case manual ajaxRequest from the  client is performed, However if yo have a logic in which taking some action in other control should update the ComboBoxes then those other control should also be added in separate setting as AjaxControlID.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Feb 2016

    Posted 10 Mar in reply to Maria Ilieva Link to this post

    Hi Maria,

    Thank you for the explanation. I get it now and I will do as you suggested when it is needed.

    Regards,

    Benjamin.

  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Mar Link to this post

    Hi Benjamin,

    I'm glad that the provided information helped. Do not hesitate to contact us back in case further assistance is needed.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017