New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Programmatic creation of RadScriptManager causes issues with RadAjaxManager

PROBLEM

When creating the script manager programmatically, the RadAjaxManager settings do not work.

Creating the script manager programmatically can also cause RadAjaxManager.GetCurrent(this.Page).ClientID to throw a null reference exception and that code is often use in the markup to reference the ajax manager.

SOLUTION

Create the RadAjaxManager programmatically as well.

Note that control creation must be done in Page_Init, but the AjaxSettings must be added in Page_Load.

You can find attached here a basic example.

In this article