RadAjax for ASP.NET

Set AjaxSettings programmatically Send comments on this topic.
AJAX Manager > How-To > Set AjaxSettings programmatically

Glossary Item Box

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_Init, Page_PreRender) so that the control could be ajaxified when the page is initially loaded.

Note that you need to assure that the controls that take part in the AJAX pair are available on the page!
The example below demonstrates how to ajaxify a Button dynamically to toggle the visibility of an Image:
ASPX/ASCX Copy Code
<rad:RadAjaxManager ID="RadAjaxManager1" runat="server" >
</
rad:RadAjaxManager>
<
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:
C# Copy Code
protected void Page_Load(object sender, EventArgs e)
   {
       RadAjaxManager1.AjaxSettings.AddAjaxSetting(Button1, Panel1,
null);
   }
...
protected void Button1_Click(object sender, EventArgs e)
   {
        Image1.Visible = !Image1.Visible;
   }

VB.NET Copy Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(Button1, Panel1, Nothing)
End Sub
...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Image1.Visible = Not Image1.Visible
End Sub