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

Updating Parent Control from Child User Control

2 Answers 457 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 25 Mar 2015, 11:58 AM
Hi All,
Just wondering how can I update parent control from child user control?
Here's the structure of my Page
Master Page
    Parent Aspx with my radmenu
         User Control with button.

When I click on my button it updates my radmenu when theres postback,
but when its ajaxified my radmenu wont update.

Any code I could use to link child to update parent control with Ajax.

Thanks in advance,
RJ

2 Answers, 1 is accepted

Sort by
0
RJ
Top achievements
Rank 1
answered on 25 Mar 2015, 02:04 PM
This code doesn't work for me.
'Get the WebUserControl
    Dim MyControl As UserControl = CType(Page.FindControl("WebUserControl1"), UserControl)

    'Get user control's button and label
    Dim MyButton As Button = CType(MyControl.FindControl("Button1"), Button) ---> Error on this line. NullReferenceException
    Dim MyLabel As Label = CType(MyControl.FindControl("Label1"), Label)

    'Add the necessary AJAX setting programmatically
    RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyButton, MyLabel)
0
RJ
Top achievements
Rank 1
answered on 26 Mar 2015, 12:16 AM
Was able to make it work.
Tags
Ajax
Asked by
RJ
Top achievements
Rank 1
Answers by
RJ
Top achievements
Rank 1
Share this question
or