AutoCompleteExtender 在 Sharepoint 2010 中不起作用
这已经困扰我几天了。我尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能直接在用户控件中托管 Scriptservice 方法,而只能在页面中托管。
You cannot host Scriptservice methods directly in user controls, just pages.