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

[Solved] RadAjaxManager does NOT work with container controls such as Panel and code behind AjaxSetting breaks!!

6 Answers 287 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jacky Chau
Top achievements
Rank 1
Jacky Chau asked on 19 Mar 2008, 01:03 AM
I asked this before, and Telerik assured me RadAjaxManager works with container controls such as ASP:Panel.  I wasted almost 2 development days trying to figure out why some of my controls were not doing Ajax calls.  I did a simple test and found two things are broken with RadAjaxManager.

ASPX Page:
    <telerik:RadScriptManager runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    </telerik:RadAjaxManager> 
    <asp:Button runat="server" ID="btnOutside" Text="Outside Panel" /> 
    <asp:Panel runat="server" ID="pnlOne">  
        <asp:Button runat="server" ID="btnInside" Text="Inside Panel" /> 
    </asp:Panel> 
    <asp:Panel runat="server" ID="pnlTwo">  
        <asp:Label runat="server" ID="lbl"></asp:Label> 
    </asp:Panel> 

Code Behind:
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.pnlOne, Me.lbl)  
        Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.btnOutside, Me.lbl)  
    End Sub 
 
    Private Sub btnInside_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnInside.Click  
        Me.lbl.Text = "btnInside" 
    End Sub 
 
    Private Sub btnOutside_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnOutside.Click  
        Me.lbl.Text = "btnOutside" 
    End Sub 

In the above example, clicking either btnInside or btnOutside will do a regular postback instead of Ajax callback.  However, if I change the order the ajax setting is added, btnOutside will do an Ajax callback but btnInside will still do a regular postback. 

    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.btnOutside, Me.lbl)  
        Me.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Me.pnlOne, Me.lbl)  
    End Sub 

This is a very simple example, and I actually spent a very long time debugging my fairly complex page.  Note that I have to set my AjaxSetting programmatically because of the structure of a BasePage and a BaseMasterPage in my web framework. 

To recap:
1.  RadAjaxManager does not work with container controls
2.  The order AjaxSettings are added programmatically can break other AjaxSettings.

So now, how do I know what's the correct order AjaxSettings are supposed to be added?  If I have a panel with 10 controls that will postback and update a label in another panel, do I have to create 10 different AjaxSettings to accomplish this? 

6 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 19 Mar 2008, 09:32 PM
To quote the response I had recently to a ticket filed on a similar issue:

"Currently dynamically altering the AjaxSettings in the Prometheus RadAjax controls is not supported. "

I ended up finding a way to add all the settings I needed at design time since you can add master page controls to the UpdatedControls sections in a child page RadAjaxManagerProxy
0
Jacky Chau
Top achievements
Rank 1
answered on 19 Mar 2008, 09:56 PM
It actually doesn't work either if you do in declaratively in the ASPX page.  And Telerik not supporting programmatically adding new AjaxSetting is a HUGE concern. 
0
Richard
Top achievements
Rank 1
answered on 19 Mar 2008, 11:20 PM
Your scenario must be different from mine.  I have a master page control (asp:Panel with some lists) that I need updated from content page controls.  I just make sure that all the AjaxSettings in the RadAjaxManagerProxy on the content pages include the master page control as an updated control, and it works fine.
0
Rosen
Telerik team
answered on 21 Mar 2008, 01:15 PM
Hi Jacky Chau,

Can you please try setting the ajaxrequest initiators to update themselves and see if this helps. Similar to this:

        RadAjaxManager1.AjaxSettings.AddAjaxSetting(pnlOne, lbl)  
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(pnlOne, pnlOne)  
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(btnOutside, lbl) 
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(btnOutside, btnOutside)

Kind regards,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jacky Chau
Top achievements
Rank 1
answered on 26 Mar 2008, 03:35 PM
If my pnlOne contains a lot of controls, I really dont want it to update itself.  Is there another alternative or a possible fix in the future?
0
Rosen
Telerik team
answered on 27 Mar 2008, 09:29 AM
Hi Jacky Chau,

If setting the panel as updated control is not possible in your scenario I will suggest to set controls inside the panel that will cause the postback as ajax initiators instead of the panel itself.

Regards,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Jacky Chau
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Jacky Chau
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or