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

Asp.Net Ajax doesnt update label

1 Answer 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Berkant Oral
Top achievements
Rank 1
Berkant Oral asked on 16 Oct 2012, 10:49 AM
I have a masterpage. my aspx page's masterpage file this master page.this aspx page has got 1 label(lblGrandTotal). i have an usercontrol in this aspx page. this usercontrol inside 1 grid(radGrid1),1 label(lblTotal) and 1 radajaxmanager. when i change dropdownlist(inside grid) it write some value to lblTotalPrice inside my usercontrol. it is working pretty. But i want to write same value to my lblGrandTotal.text property. I write this code for this operation. I can take my lblGrandTotal and set my value to lblGrandTotal but i cant see this change in my aspx page.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="lblTotal" LoadingPanelID="RadAjaxLoadingPanel1" />                                                 

        public void SetGrandTotalPrice(decimal price)
            var lblGrandTotal = Page.Master.FindControl("cphCenter").FindControl("lblGrandTotal") as Label;
            lblGrandTotal.Text = price.ToString();            

How can i resolve this problem
Best Regards

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 19 Oct 2012, 04:10 AM
Hello Berkant,

You need to add an ajax setting to the label control programmatically as the static one won't work since the ID of the control is a different one at runtime on account of its being located in the maser page.

I'd recommend that in the OnInit event you get the RadAjaxManager programmatically through the static method: RadAjaxManager.GetCurrent(this.Page). Then find the label control and and an ajax setting where the grid is the updating control and the label the updated.

Hope it helps.

Regards, Tsvetoslav
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.
General Discussions
Asked by
Berkant Oral
Top achievements
Rank 1
Answers by
Telerik team
Share this question