Paul Kiddie

Using ASP.NET AJAX with DotNetNuke 4.5 or greater

August 08, 2007

I’ve recently been doing some website UI work using the ASP.NET AJAX extensions in which I had a ScriptManager instance and controls that needed updating within an UpdatePanel instance.

It turns out that it’s not as easy as moving the web control to my DotNetNuke site and loading it up, I got the following error: Only one instance of a ScriptManager can be added to the page.

With a little bit more delving around it turns out that DotNetNuke injects an instance of the ScriptManager by default, and its just a simple case of getting hold of this instance and using it, which means simply removing the ScriptManager instance from my web control, and with the following bit of code:

if (DotNetNuke.Framework.AJAX.IsInstalled())            {                DotNetNuke.Framework.AJAX.RegisterScriptManager();

               ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);

           }

}

it now works!


👋 I'm Paul Kiddie, a software engineer working in London. I'm currently working as a Principal Engineer at trainline.