简体   繁体   中英

Only one instance of a ScriptManager can be added to the page: issue with Ajax Toolkit?

I am on visual studio 2012. I need to add in the CollapsablePanelExtender for my site. Because there is a ScriptManager on the MasterPage, I cannot figure out how I can add in the ToolkitScriptManager. When I try to use Scriptmanagerproxy, the web.config crashes and tells me I must use ToolkitScriptManager. When I use my toolkitscriptmanager with the master page's scriptmanager, the site also crashes and says ToolkitScriptManager cannot be found, and "only one instance of ScripManager is allowed.

I have the following code on the masterPage:

<asp:ScriptManager runat="server">
    <Scripts>
        <%--Framework Scripts--%>
        <asp:ScriptReference Name="MsAjaxBundle" />
        <asp:ScriptReference Name="jquery" />
        <asp:ScriptReference Name="jquery.ui.combined" />
        <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
        <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
        <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
        <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
        <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
        <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
        <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
        <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
        <asp:ScriptReference Name="WebFormsBundle" />
        <%--Site Scripts--%>

    </Scripts>
</asp:ScriptManager>

And I have the following code to be used in an actual page.

 <asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"></asp:ToolkitScriptManager>
<h3>We suggest the following:</h3>
<ol class="round">
    <li class="one">
        <asp:Panel ID="pnlRec" runat="server"><h5>Getting Started with Recreation</h5><br />
            <asp:Label ID="lblMsg" runat="server" Text="Label"></asp:Label></asp:Panel>
        <asp:Panel ID="cpnlRec" runat="server"><table><tr>
                <td>Stuff</td><td>Stuff</td><td>Stuff</td>
                   </tr></table></asp:Panel>
        <asp:CollapsiblePanelExtender  ID="cpeRec" runat="server"  CollapseControlID="pnlClick" Collapsed="True" ExpandControlID="pnlClick" CollapsedText="Show" ExpandedText="Hide" TextLabelID="lblMsg" TargetControlID="cpnlRec">

        </asp:CollapsiblePanelExtender>

Check the Designer.cs file and confirm that you don't have any other reference to toolkitscriptmanager. if found remove those references. Clean it and build it. It might be the reason for Error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM