user222427
user222427

Reputation:

only one instance of a scriptmanager can be added to the page Ajax + Telerik

I'm trying to use Ajax accordion and the telerik RadScriptmanager to have an AJAX dynamic accordion and drag and drop control. This is what I have in my .aspx but i'm not able to figure out how to use both script managers. Thanks!

<td width="29%" height="135">
    <ajaxToolKit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="Server" />
<Scripts>
            <ajaxToolkit:Accordion ID="NavigateAccordion" runat="server" 
                                       HeaderCssClass="accordionHeader" 
                                       ContentCssClass="accordionContent" 
                                       FadeTransitions="true" 
                                       SuppressHeaderPostbacks = "true" 
                                       AutoSize="None"
                                       Width="220">
                                            </ajaxToolkit:Accordion>
</td>
<td width="71%">
    &nbsp;</td>


                            <form id="form2" runat="server">
<telerik:RadScriptManager ID="ScriptManager1" runat="server">

        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    </Scripts>
</telerik:RadScriptManager>
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="Buttons" />

Upvotes: 1

Views: 7232

Answers (2)

Chris Marisic
Chris Marisic

Reputation: 33098

You only need 1 script manager in your page (most likely in a master page).

You then want to use the built in ASP.NET Script Mananger proxy classes to talk to it from a webform page.

Edit: Regarding your comment, I would look at just trying moving the

<Scripts>
...
</Scripts>

Block into the the ajax tool kit script manager.

More along these lines:

<ajaxToolKit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="Server">
    <Scripts>
      <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    </Scripts> 
</ajaxToolKit:ToolkitScriptManager>

And remove the usage of the RadScriptManager

Upvotes: 0

Brian Mains
Brian Mains

Reputation: 50728

You can't use both script managers; since both inherit from System.Web.UI.ScriptManager, and ScriptManager expects only one instance of itself (defined internally), this scenario will never work. Use one or the other. You don't need to have an ToolkitScriptManager for the AJAX control toolkit to work; however, the script manager has to be at the top of the page, before the other AJAX controls.

Upvotes: 3

Related Questions