簡體   English   中英

只能將ScriptManager的一個實例添加到頁面:Ajax Toolkit出現問題?

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

我使用的是Visual Studio2012。我需要為我的站點添加CollapsablePanelExtender。 因為在母版頁上有一個ScriptManager,所以我無法弄清楚如何在ToolkitScriptManager中添加。 當我嘗試使用Scriptmanagerproxy時,web.config崩潰並告訴我必須使用ToolkitScriptManager。 當我將我的toolkitscriptmanager與母版頁的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>

檢查Designer.cs文件,並確認您沒有對toolkitscriptmanager的其他引用。 如果找到,請刪除這些引用。 清潔並建造它。 這可能是錯誤的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM