只能将一个ScriptManager实例添加到页面中

时间:2011-06-30 18:22:31

标签: asp.net sharepoint-2010 ajaxcontroltoolkit toolkitscriptmanager

我正在尝试将ToolkitScriptManager添加到我的页面以便使用AjaxControlToolkit。这是我的代码:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestingAjaxWebPartUserControl.ascx.cs" Inherits="TestingAjax.TestingAjaxWebPart.TestingAjaxWebPartUserControl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<html>
<body>
<form>
<cc1:ToolkitScriptManager runat="server" ID="toolkitScriptManager"></cc1:ToolkitScriptManager>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" 
         TargetControlID="TextBox2"
         ServiceMethod="GetCompletionList"
         ServicePath="TestingAjaxWebPartUserControl.ascx.cs"
         MinimumPrefixLength="2"
         CompletionInterval="1000"
         EnableCaching="true"
         CompletionSetCount="10">
        </cc1:AutoCompleteExtender>
</form>
</body>
</html>

但是,当我加载页面时,它会抛出一个错误,指出只能运行一个脚本管理器实例。我几乎整天都在研究这个问题,这让我疯狂。另一个脚本管理器可以在哪里,如何禁用它以便我的页面加载?

3 个答案:

答案 0 :(得分:0)

检查您在页面或母版页中引用的用户控件(如果有)?

答案 1 :(得分:0)

尝试在身体内的所有内容周围放置一个表格标签......

<body>
    <form id="form1" runat="server">
        <cc1:ToolkitScriptManager runat="server" ID="toolkitScriptManager">
        </cc1:ToolkitScriptManager>
        ...
    </form>
</body>

答案 2 :(得分:0)

您需要在表单标记内部使用asp.net控件和ajax控件。