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

Update control in master page from ajaxified button in content

1 Answer 49 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Blop asked on 25 May 2012, 09:59 AM

Here's my issue: I ve a button in my content page, on click I want to upload a label in my master page with ajax.

I've read that: 
and tried something like that:

In my content page: 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load      
           Dim AjaxManager As RadAjaxManager = CType(Me.Master.FindControl("radAjaxManMaster"), RadAjaxManager)
           Dim lbl  As Label = CType(Master.FindControl("myLabel"), Label) 
           AjaxManager.AjaxSettings.AddAjaxSetting(btnAdd, lblCartItemCount, Nothing)   
    End Sub

Protected Sub btnAjouter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    Dim lbl As Label = CType(Me.Master.FindControl("myLabel"), Label)
            lbl.Text = "New value"
End Sub

On the masterpage I ve that: 
 <telerik:RadAjaxManager ID="radAjaxManMaster" runat="server"  DefaultLoadingPanelID="RadAjaxLoadingPanel1">

<asp:Label id="myLabel"  runat="server"></asp:Label>

The loadingpanel is displayed on my label but it keeps the old value...

What I dont get its that it is rendering page cycle twice (two time page load on master page and contentpage)
(When I'm removing the three lines in page load of content page it works as it should (no page event called twice and label is updated but page is postback and no ajax...)) 

Could someone help me?

1 Answer, 1 is accepted

Sort by
Iana Tsolova
Telerik team
answered on 25 May 2012, 03:39 PM

Where is the ScriptManager defined? Its definition should be before this of the RadAjaxmanager.
In addition, the best way to get reference to the RadAjaxManager object is to use RadAjaxMnager.GetCurrent(Page) method instead of calling FindControl.

However I prepared a sample page illustrating how you can achieve your goal. There Page_Load is fired as expected on my end. Try it our and let me know if it works for you.

Iana Tsolova
the Telerik team
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 their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question