New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Ajaxify and Update Controls in Master and Content Page with the AjaxManager

Environment

ProductProgress® Telerik® UI for ASP.NET AJAX AjaxManager

Description

How can I enable AJAX and update every single control in my application with the AjaxManager in my MasterPage?

Solution

The following example shows how to achieve the desired scenario by adding the necessary AJAX settings programmatically. The sample application contains buttons in the master and content page. The two buttons update controls in the master and content page as well.

* The initiator of the AJAX request (the first argument AddAjaxSetting receives) must be an IPostBack control. This means that the initiator must be a control that performs a postback on its own (like a button or a grid) and not a simple container (like an <asp:Panel> control). Containers do not invoke the request themselves and the AjaxManager cannot identify if the request comes from their children because the container ID is not present in the POST parameters.

  • Using a container like a Panel for an AJAX initiator can result in various issues like initiating full postbacks instead of AJAX requests, or an unexpected list of updated controls.

Master Page

ASP.NET
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnDecrease">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="TextBox1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<asp:LinkButton ID="btnDecrease" runat="server" OnClick="btnDecrease_Click">Decrease</asp:LinkButton>
<asp:TextBox ID="TextBox1" runat="server">0</asp:TextBox>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>

Content Page

ASP.NET
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Button ID="btnIncrease" runat="server" Text="Increase" OnClick="btnIncrease_Click" />
    <asp:Label ID="Label1" runat="server" Text="0"></asp:Label>
</asp:Content>
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support