• Using ASP.NET AJAX with DotNetNuke 4.5 or greater

    by  • August 8, 2007 • asp.net, dotnetnuke • 0 Comments

    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!

    About

    .NET developer at thetrainline.com, previously web developer at MRM Meteorite. Awarded a PhD in misbehaviour detection in wireless ad-hoc networks.A keen C# ASP.net developer bridging the gap with APIs and JavaScript frameworks, one web app at a time.

    http://www.paulkiddie.com

    Leave a Reply

    Your email address will not be published. Required fields are marked *