AutoCompleteExtender 在 Sharepoint 2010 中不起作用

发布于 2024-11-27 07:12:10 字数 1737 浏览 0 评论 0原文

这已经困扰我几天了。我尝试在 Sharepoint 2010 的 Visual Web Part 项目中使用 AutoCompleteExtender,但是当我输入字符时没有任何反应。起初我以为这是一个 Ajax 问题,所以我使用了 TextBoxWatermarkExtender 并且它有效,所以它一定不是一个 ajax 问题。

我逐字遵循了这个人的指南: http:// ranaictiu-technicalblog.blogspot.com/2010/08/ajax-control-toolkit-with-sharepoint.html

这是我的ascx:

<%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral,         PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
 TargetControlID="TextBox1"
  WatermarkText="I'm awesome">
</cc1:TextBoxWatermarkExtender>

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="TextBox1" ServiceMethod="GetCompletionList">
</cc1:AutoCompleteExtender>

这是我的代码隐藏:

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace TestingAjax2.TestingAjax2
{

    public partial class TestingAjax2UserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public string[] GetCompletionList(string prefixText, int count)
        {
            string[] n = { "banana", "orange", "apple", "tunafish" };
            return n;
        }

    }
}

任何帮助将不胜感激。我正在和另外一个人一起工作,我们都完全困惑为什么它不起作用。

This has been bothering me for a few days now. I'm trying to use the AutoCompleteExtender in a Visual Web Part project for Sharepoint 2010 but when I type in characters nothing happens. At first I thought it was an Ajax issue so I used the TextBoxWatermarkExtender and that works, so it must not be an ajax thing.

I followed this guys guide VERBATIM: http://ranaictiu-technicalblog.blogspot.com/2010/08/ajax-control-toolkit-with-sharepoint.html

Here's my ascx:

<%@ Register Assembly="AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral,         PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
 TargetControlID="TextBox1"
  WatermarkText="I'm awesome">
</cc1:TextBoxWatermarkExtender>

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="TextBox1" ServiceMethod="GetCompletionList">
</cc1:AutoCompleteExtender>

Here's my codebehind:

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace TestingAjax2.TestingAjax2
{

    public partial class TestingAjax2UserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public string[] GetCompletionList(string prefixText, int count)
        {
            string[] n = { "banana", "orange", "apple", "tunafish" };
            return n;
        }

    }
}

Any help would be appreciated. I'm working with one other guy and we're both completely baffled as to why it isn't working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯然 2024-12-04 07:12:10

您不能直接在用户控件中托管 Scriptservice 方法,而只能在页面中托管。

You cannot host Scriptservice methods directly in user controls, just pages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文