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

Issue updating display with code behind using RadAjaxManager AjaxRequest

5 Answers 146 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 04 Mar 2016, 10:10 AM

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,

5 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 09 Mar 2016, 09:16 AM
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
0
Benjamin
Top achievements
Rank 1
answered on 09 Mar 2016, 09:39 AM

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.

0
Maria Ilieva
Telerik team
answered on 10 Mar 2016, 03:29 PM
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.
0
Benjamin
Top achievements
Rank 1
answered on 10 Mar 2016, 03:32 PM

Hi Maria,

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

Regards,

Benjamin.

0
Maria Ilieva
Telerik team
answered on 11 Mar 2016, 03:28 PM
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.
Tags
Ajax
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Benjamin
Top achievements
Rank 1
Share this question
or