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

[Solved] Having a usercontrol updating the contentpage with radajaxmanager

7 Answers 269 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Thomas Garp
Top achievements
Rank 1
Thomas Garp asked on 02 Dec 2008, 11:11 AM
Hi.
This problem may have been answered in previous posts, but I can't seem to find the answer anywhere.
I have a Masterpage with a RadAjaxmanager control, a contentpage with a radAjaxManagerProxy, and a usercontrol also with a RadAjaxManagerProxy.
Now, In the usercontrol i have a dropdown with autopostback which is ajaxified by the radajaxmanagerproxy. When the value changes, the usercontrol fires an event in order to have the contentpage change correspondingly to the selection made in the usercontrol. The event fires, but nothing changes in the contentpage, probably due to the fact, that the dropdown inside the usercontrol is not set to update any controls in the parent page.
How can this problem be solved?

Regards
Thomas Garp

7 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 02 Dec 2008, 01:15 PM
Hi Thomas Garp,

Could you please elaborate a little bit more on how  the UserControl is loaded on the page. Also please let me know whether the problem appears if the Ajax is disabled on the page. Some more information on your scenario and the required functionality will helps us provide accurate solution for your application.

Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Thomas Garp
Top achievements
Rank 1
answered on 02 Dec 2008, 02:51 PM
Turning ajax off makes the page perform exactly the way i want it, except without ajax, of course :-)
The usercontrol has been placed on the content page at design time, like this

 <uc3:ItemSelector ID="ItemSelector1" runat="server" /> 

I've tried to point the usercontrol to the different controls i want updated on the contentpage in the ajaxmanager configuration designer, but with no luck.

The usercontrol fires a custom made event,  which the contentpage is subscribing to, when the selection in the dropdown  changes:

  ItemSelector1.StructureListItemChanged += 
new EventHandler(ItemSelector1_StructureListItemChanged); 

In the eventhandler on the contentpage, I now update the different controls on the page, from the selected value in the usercontrol

 void ItemSelector1_StructureListItemChanged(object sender, EventArgs e)  
        {  
            DropDownList ddl = (DropDownList) sender;  
 
//Then I retrieve the selected value, and update some controls on the contentpage accordingly  
 
        } 
0
Maria Ilieva
Telerik team
answered on 05 Dec 2008, 09:11 AM
Hi Thomas,

Will it be convenient for you to send us sample runnable project which replicates the exact problem you are facing? We will test it locally and advise you further.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Julie Gephart
Top achievements
Rank 1
answered on 07 Apr 2009, 08:57 PM
I'm in exactly the same situation - isn't there any advice you can offer generally about making an event inside a usercontrol update a section of the page outside the usercontrol with RadAjaxManager? In other words, the AjaxControlID is inside a usercontrol, but the AjaxUpdatedControl is outside the usercontrol on the containing page. 

<uc1:theusercontrol id="theusercontrol1" runat="server" />
<asp:panel id="pnlToUpdate" runat="server">
    here is some content I need to update when a combobox selection inside theusercontrol1 changes.
</asp:panel>
0
Iana Tsolova
Telerik team
answered on 08 Apr 2009, 09:08 AM
Hi Julie,

You can achieve your purpose by adding the desired ajax settings dynamically for instance, on Page_Load or on Page_PreRender. Find more information in this online help topic.

Give it a try and let me know if you need further directions/help.

Regards,
Iana
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Julie Gephart
Top achievements
Rank 1
answered on 08 Apr 2009, 03:50 PM
Thanks. I had some confusion about what exactly to hook up and whether to do it from the usercontrol or the content page, but I've got it working now. For anyone else who might have the same questions, I ended up making the combobox declaration public in my usercontrol so that I could refer to it from my page as usercontrol1.radcombobox1 and use that as the AjaxControlID.
0
Bridge24
Top achievements
Rank 1
Iron
Iron
answered on 06 May 2009, 06:20 PM
Hi everybody.  I just had the same trouble, and found another solution that works fine.

setup.
1. masterpage
2. ASPX page
3. ASCX page in the aspx page.

on the save button on the ASCX, I want to update a grid in the ASPX.

On my ascx page, I created a public event, and on the save button I raise this event.

On the ASPX page, I only do an ajaxmanager configuration that tells the local (aspx) radgrid to update when there is any event (no event specified) on the usercontrol object.

And it works fine.
        <telerik:AjaxSetting AjaxControlID="ProductDetailUC1"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="dgproducts" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting>       
 ...
<uc1:ProductDetailUC ID="ProductDetailUC1" runat="server" />  

'usercontrol 
Public Partial Class ProductDetailUC 
... 
Public Event ProductChanged(ByVal _id As Integer)

Private Sub Save() 
... 
RaiseEvent ProductChanged(Me.ItemID) 
end sub 
... 
End Class 

Hope it may help someone
Tags
Ajax
Asked by
Thomas Garp
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Thomas Garp
Top achievements
Rank 1
Julie Gephart
Top achievements
Rank 1
Iana Tsolova
Telerik team
Bridge24
Top achievements
Rank 1
Iron
Iron
Share this question
or