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

Is this expected behavior of RadAjaxManager

6 Answers 64 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 11 Feb 2011, 10:48 AM
Hello, I hope community and Telerik staff will help me to understand if I want too much from RadAjaxManager, and point me what I'm doing wrong.
Trying to explain to support person my problem for almost 4 days now, and still did not get any clear answer, or confirmation that behavior I'm expecting is bug or "by-design".

Anyway, I'm having RadScriptManager and RadAjaxManager controls created on my master page, and then I have this on my content page:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 
<telerik:RadAjaxManagerProxy runat="server">
 
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="cmdButton1" EventName="Click">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnl1" />
                <telerik:AjaxUpdatedControl ControlID="pnl2"  />
            </UpdatedControls>
        </telerik:AjaxSetting>
 
        <telerik:AjaxSetting AjaxControlID="cmdButton2" EventName="Click">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnl2"  />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
 
<asp:Button ID="cmdButton1" runat="server" Text="Button 1" OnClick="cmdButton1_Click" />
 
<asp:Panel ID="pnl1" runat="server">
 
    <asp:Button ID="cmdButton2" runat="server" Text="Button 1" OnClick="cmdButton2_Click" />
    <asp:Label ID="lblPnl1" runat="server" />
</asp:Panel>
 
<asp:Panel ID="pnl2" runat="server">
    <asp:Label ID="lblPnl2" runat="server" />
</asp:Panel>
 
</asp:Content>

and this is code I have in code-behind

protected void Page_Load(object sender, EventArgs e)
{
  lblPnl1.Text = lblPnl2.Text = DateTime.Now.ToString();       
}
 
protected void cmdButton1_Click(object sender, EventArgs e)
{
  //do nothing Page_Load will update content of labels
}
 
protected void cmdButton2_Click(object sender, EventArgs e)
{
  //do nothing Page_Load will update content of labels
}

As you can see I have 2 buttons, and I defined for them 2 AjaxSettings inside RadAjaxManagerProxy
So, according to these settings I'm expecting the following behavior:

1. When button cmdButton1 is clicked - RadAjaxManager should refresh my pnl1 and pnl2 Panels
2. When button cmdButton2 is clicked - RadAjaxManager should only refresh my pnl2 Panel.

However, when I'm clicking cmdButton2 - BOTH panels beeing refreshed.

If I remove AjaxSetting for button1 and click button2 - things starting work as expected (e.g. pnl1 is not refreshing)

So it seems that AjaxSetting for button1 somehow forces RadAjaxManager to refresh pnl1, even when button1 was not clicked.

Is this expected? Or bug? What you guys think? What behavior you would expect?

I gave up trying to explain why I think this is bug to support person :(

Maybe I don't understand something?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 15 Feb 2011, 12:46 PM
Hello Alex,

Indeed the described behavior is expected. When you set a container control, like ASP:Panel as updated control through the RadAjaxManager settings, it is being wrapped in ajax panel similar to ASP:UpdatePanel so every control in it performs callback and updats it.

To overcome the issue, you can try handling the AjaxSettingCreated event of the RadAjaxManager as below:

protected void Page_Init(object sender, EventArgs e)
{
    RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
    manager.AjaxSettingCreated += new RadAjaxControl.AjaxSettingCreatedDelegate(manager_AjaxSettingCreated);
}
void manager_AjaxSettingCreated(object sender, AjaxSettingCreatedEventArgs e)
{
    if (e.Updated == pnl1)
    {
        e.UpdatePanel.ChildrenAsTriggers = false;
    }
}


Kind regards,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alex
Top achievements
Rank 1
answered on 15 Feb 2011, 01:07 PM
Thanks for this workaround. I would suggest to make this setting more visible, like it is done for standard ASP.NET UpdatePanel control.
I don't believe this workaround is documented in product documentation?

I think it might be even better to set ChildrenAsTriggers to be false by default, so updates can be clearly controlled by AjaxSettings. Although you might don't want to do it, because it will affect existing applications...

Can it be added as configurable setting of RadAjaxManager? set to TRUE by default, so it will not affect current applications?
0
Iana Tsolova
Telerik team
answered on 17 Feb 2011, 03:25 PM
Hi Alex,

Indeed, we will consider adding the approach to RadAjax documentation.
Regarding the ChildrenAsTriggers property: We cannot change its default value for backward compatibility and because its default value is true for ASP:UpdatePanel as well. However I will forward your request to add it in the declarative settings to our developers for further consideration.
 
Kind regards,
Iana
the Telerik team
0
Alex
Top achievements
Rank 1
answered on 18 Feb 2011, 08:19 AM
OK. Thanks
0
Sathish
Top achievements
Rank 1
answered on 01 Jan 2014, 10:41 PM
Hi,

I want to include ChildrenAsTriggers as a property to AjaxUpdatedControl setting. Is there anyway I can extend it, so that instead of 

<telerik:AjaxUpdatedControl

I can have my own <uc:CustomAjaxUpdatedControl which has ChildrenAsTriggers property and somehow automate this process? I basically want to specify it inline in the aspx defenition. 

Is there any telerik classes that I can override to set this property?


Public Class CustomAjaxUpdatedControl
    Inherits Global.Telerik.Web.UI.AjaxUpdatedControl
 
    Public Property ChildrenAsTriggers As Boolean = True
 
End Class
0
Maria Ilieva
Telerik team
answered on 06 Jan 2014, 12:57 PM
Hello Sathish,

We do not suggest globally overwrite the mentioned  property. However I would ask you to describe the exact scenario you have an the required functionality you need to achieve so that we could propose better solution for your case based on the improvements we have for the Ajax controls.

Regards,
Maria Ilieva
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.
Tags
Ajax
Asked by
Alex
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Alex
Top achievements
Rank 1
Sathish
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or