只能将一个ScriptManager实例添加到页面中:Ajax Toolkit问题?

时间:2013-01-23 23:51:01

标签: asp.net visual-studio-2012 master-pages scriptmanager toolkitscriptmanager

我在visual studio 2012上。我需要为我的网站添加CollapsablePanelExtender。因为MasterPage上有一个ScriptManager,我无法弄清楚如何在ToolkitScriptManager中添加。当我尝试使用Scriptmanagerproxy时,web.config崩溃并告诉我必须使用ToolkitScriptManager。当我将toolkitscriptmanager与master页面的scriptmanager一起使用时,该站点也会崩溃,并且无法找到ToolkitScriptManager,并且“只允许一个ScripManager实例。”

我在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>

我在实际页面中使用以下代码。

 <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>

1 个答案:

答案 0 :(得分:0)

检查Designer.cs文件并确认您没有任何其他对toolkitscriptmanager的引用。如果找到删除那些引用。清洁并建造它。这可能是错误的原因。