RadAjax for ASP.NET AJAX

RadControls for ASP.NET AJAX

In some cases you need to add AJAX pairs dynamically (at runtime). You should always do this in a Page event handler, which is executed each time during the page lifecycle (Page_Load, Page_PreRender) so that the control could be ajaxified when the page is initially loaded.

Note

Note that you need to assure that the controls that take part in the AJAX pair are available on the page!

Note

You cannot add AJAX settings dynamically in the Page_Init event. It is too early in the page lifecycle since the RadAjaxManager is not created yet.

The example below demonstrates how to ajaxify a Button dynamically to toggle the visibility of an Image:

CopyASPX
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Panel ID="Panel1" runat="server" Height="95px">
    <asp:Image ID="Image1" runat="server" ImageUrl="http://www.Telerik.com/images/Homepage/TelerikLogo.gif" />
</asp:Panel>

And in the code-behind: