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

RadAjaxManagerProxy in User Control

2 Answers 228 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Dave Miller
Top achievements
Rank 2
Dave Miller asked on 28 Sep 2008, 04:48 PM
I have a page with multiple usercontrols. I am using RadAjaxManagerProxy to add controls in the user controls with one RadAjaxManager on the main page.

To update usercontrols from other usercontrols I am sending commands to the RadAjaxManager via javascript functions such as

function

ajaxMngrRequest(args){var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest(args);
}

which then finds the controls and updates them. If I add the controls to be updated in the RadAjaxManagerProxy on the .ascx this all works fine.

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ProdItemList" />
                <telerik:AjaxUpdatedControl ControlID="lblOrderItems" />
                <telerik:AjaxUpdatedControl ControlID="BtnSubmitItemOrder" />
            </UpdatedControls>
        </telerik:AjaxSetting>


RadAjaxManager1 is on the main page with the updated controls in the usercontrol.

The problem is I have one usercontrol with 2 placeholders containing datalists that are shown at different times, and not together, and if I add both to the update controls I get an error that it cannot find the one that is hidden.

What it seems I must do is only add the controls to the RadAjaxManagerProxy in the ascx.cs so that only the controls that are visible. But I cannot seem to get this to work. Here is what I have tried

AjaxManagerProxy1.AjaxSettings.AddAjaxSetting(ProdItemList, ProdItemList);

and 

AjaxSetting ajaxSetting = new Telerik.Web.UI.AjaxSetting("RadAjaxManager1");
ajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl("ProdItemList", "RadAjaxLoadingPanel1"));
RadAjaxManagerProxy1.AjaxSettings.Add(ajaxSetting);

I have also tried adding it to the AjaxManager on the main page like

AjaxSetting ajaxSetting = new Telerik.Web.UI.AjaxSetting("RadAjaxManager1");
ajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl("ProdItemList", "RadAjaxLoadingPanel1"));
RadAjaxManager.GetCurrent(Page).AjaxSettings.Add(ajaxSetting);

I tried just adding controls to the RadAjaxManagerProxy that are just in the usercontrol.

AjaxSetting ajaxSetting = new Telerik.Web.UI.AjaxSetting("ProdItemList");
ajaxSetting.UpdatedControls.Add(new AjaxUpdatedControl("ProdItemList", "RadAjaxLoadingPanel1"));
RadAjaxManagerProxy1.AjaxSettings.Add(ajaxSetting);

Is it possible to add controls to the RadAjaxManagerProxy in the code behind of a user control?

Thanks,
Dave

2 Answers, 1 is accepted

Sort by
0
Dave Miller
Top achievements
Rank 2
answered on 29 Sep 2008, 01:31 PM

Adding it to the AjaxManagerProxy in the user control on page load like this  does work. When I tried it first I had another issue that was causing the problem.

AjaxSetting

ajaxSetting = new Telerik.Web.UI.AjaxSetting("RadAjaxManager1");

ajaxSetting.UpdatedControls.Add(

new AjaxUpdatedControl("ProductList", "RadAjaxLoadingPanel1"));

AjaxManagerProxy1.AjaxSettings.Add(ajaxSetting);

I hope this may help someone else.

Regards,
Dave

0
Paul Taormino
Top achievements
Rank 1
answered on 06 Feb 2009, 12:03 AM
Dave,

It helped me immensely.  Thanks,

Paul
Tags
Ajax
Asked by
Dave Miller
Top achievements
Rank 2
Answers by
Dave Miller
Top achievements
Rank 2
Paul Taormino
Top achievements
Rank 1
Share this question
or