Telerik UI for ASP.NET AJAX

This help article describes how to work with RadAjaxManagerProxy controls and provides an example.

RadAjax allows only one RadAjaxManager on a page. So in a complex scenarios like WebUserControls or Master/Content Pages, you should place a RadAjaxManager instance on the main/master page and then add a RadAjaxManagerProxy control to the user control/content page. RadAjaxManagerProxy copies the exact same RadAjaxManager designer configuration so that you can set all the necessary AJAX settings within the WebUserControl/ContentPage entirely through the designer. Example 1 shows how you could use RadAjaxManagerProxy to Ajax-enable controls within a WebUserControl/ContentPage.

Example 1: RadAjaxManagerProxy sample configuration.

CopyASPX
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="DropDownList1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="DetailsView1" />
                <telerik:AjaxUpdatedControl ControlID="GridView1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="GridView1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="GridView1" />
                <telerik:AjaxUpdatedControl ControlID="DetailsView1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

Using the RadAjaxManagerProxy makes design-time configuration easier. The RadAjaxManagerProxy does not provide client-side functionality as the RadAjaxManager does. Also, RadAjaxManagerProxy does not have client-side object or functions like ajaxRequest/ajaxRequestWithTarget and client-side events. Instead, you can get the RadAjaxManager instance through the GetCurrent static method (Example 2) similar to the asp:ScriptManager control and call the master RadAjaxManager client-side methods if necessary.

Example 2: Getting instance of RadAjaxManager and firing an Ajax request.

CopyASPX
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function myUserControlClickHandler() {
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
        }
    </script>
</telerik:RadCodeBlock>
Caution

When you use a server-side code block (like in Example 2) you should wrap the entire script in a RadCodeBlock. This is necessary to prevent the server error System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

If you need to handle the master manager events in the user control or content page, you can attach event handlers to the RadAjaxManager as shown in Example 3.

Example 3: Attaching event handlers to a RadAjaxManager in a ContentPage

Note

If you need to add AJAX settings programmatically, it is recommended that you get the master RadAjaxManager instance and call its methods/properties as well. The same GetCurrent method could be used to access the RadAjaxManager placed in the Master/Main page from a Content page/WebUserControl.

See Also