RadAjax for ASP.NET

AJAX Manager Send comments on this topic.
See Also
AJAX Manager > AJAX Manager

Glossary Item Box

AJAX Manager is one of the two major controls of the Telerik RadAjax suite. The other one is AJAX Panel. AJAX Manager allows developers rapidly develop powerful and complex AJAX solutions.

The main features of AJAX Manager are:

  • You can ajaxify all controls that normally work with postbacks.
  • Defines visually and codeless (in Visual Studio design-time) which elements should initiate AJAX requests and which elements should be updated
  • No need to modify your application logic
  • Allows you to update a number of page elements at once regardless of their position on the page.
  • No need to write any JavaScript or invoke AJAX requests manually

Using a single AJAX Manager on the page you can create complex web applications like Microsoft Outlook ® Web Access portal.

The visual designer of AJAX Manager, accessible in VisualStudio, lets you set even the most complicated update scenarios such as:

A single control to update one or more controls with an AJAX request:

1 updates 2 and 3

Update schema

A second control to update other controls (or even controls from the previous scenario) with an AJAX request:

3 updates 2 and 5

A control to update itself with an AJAX request:

6 updates 6 (i.e. itself)

Call the AJAX Manager API from a control on the page and update control(s) on the page

Using the AJAX manager API,
2
is made to update 1 and 4

In order to use AJAX Manager, you need to drag it from the VisualStudio toolbox to your page.

Note that you can't have two AJAX Managers in a single NamingContainer. You can have one AJAX Manager on the page and another in an UserControl loaded on the page. You may also use one RadAjaxManager in a MasterPage and another one in a ContentPage of this MasterPage.


Setting the control relations in Property Builder

AJAX Manager comes with a visual builder for setting the relations between the AJAX request initiator and the controls that will be updated. You can start the property builder by choosing the Configure Ajax Manager command in the control's smart tag.

The property builder is pretty intuitive and simple to use. The tool has three panes:

  1. The left pane is a treeview with all controls on the page. Select a control that will initiate the callback request. Only the controls that have their check-boxes checked will initiate callbacks. Once you select the control in this pane, you need to choose the controls that will be updated. This can be done in the middle pane.
  2. The middle pane is another treeview with all controls on the page. Here you can select which controls will be updated after a callback request from the control checked and selected in the left pane.
    Please note that your selection in the middle pane can be applied only to one control from the left pane. Thus you can have different sets of controls that will be updated depending on the callback initiator control (from the left pane). After you set the controls that will be updated, you may select a Loading panel for each one of them. The Loading panel is set in the right pane.
  3. The right pane lets you specify the Loading panel that will be used for the controls selected in the middle pane.  Each control that will be updated can have a separate Loading panel set. A default loading panel could be set as well through DefaultLoadingPanelID property of RadAjaxManager control. If it is used, there is no need to set the loading panel on each new AJAX setting - the default loading panel will be automatically applied everywhere.

    The property builder

 

Setting the control relations in CodeBehind

You can set the relationship between ajaxified and updated controls on server-side as well. For this purpose you need to use the AddAjaxSetting method:

RadAjaxManager1.AjaxSettings.AddAjaxSetting(<ajaxified control>, <updated control>, <LoadingPanel> or null if none);

Client-side functions

You can make any external control to force AJAX Manager perform an AJAX request by calling this client-side function. When using this function the event target defaults to the RadAjaxManager instance. 

You can construct the javascript function calls manually or alternatively use the server-side method GetAjaxEventReference and have Telerik RadAjax generate the necessary code for you.

 

<%=AjaxManager1.ClientID%>.AjaxRequest(arguments)

arguments The parameters, which the control had used when it raised the request

This function can be handled by the AjaxRequest event on the server.

 

The AjaxRequestWithTarget(eventTarget, eventArgument) function can be called to simulate a postback/AJAX request send by other control with the specified UniqueID and specified arguments. 

__doPostBack(eventTarget, eventArgument)

or

<%=AjaxManager1.ClientID%>.AjaxRequestWithTarget(eventTarget, eventArgument)

eventTarget The control which should raise postback event. Otherwise if your control is in a INamingContainer, you should use the control's UniqueID.
eventArgument This is optional argument for the event


When you set a control as eventTarget it will raise an AJAX request and will update the controls that it was set to update in the property editor. This function can be handled by the correspondent event handler (i.e. Button_Click) on the server. 

See Also