• 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

    Web Developer for MRM Meteorite. Awarded a PhD in research into novel techniques to detect misbehaviour in peer-to-peer wireless networks. Experienced C# and ASP.net developer, with an interest in SOA, RIA and moble app development.

    http://www.paulkiddie.com

    Leave a Reply

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