我想实现自动提示文本box.I已经检查了其他职位似乎没有任何要工作我,我无论是在Web应用程序试图与website.Please在我的代码计算outthe错误英寸当我在文本框中键入字母时,什么都不会发生。我可以在浏览器中看到webservice结果。自动提示使用AJAX
delete.aspx
Inherits="WebApplication2.Delete" %>
Assembly="AjaxControlToolkit"%>
Untitled PageEnablePartialRendering="true"
runat="server">
TargetControlID="myTextBox"
ServiceMethod="Information"
ServicePath="~/WebService1.asmx"
OnClientItemOut="Information"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="5"
ShowOnlyCurrentWordInCompletionListItem="true">
webservice1.asmx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WebApplication2
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService1 : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[]Information(string prefixText)
{
RDFEntities db = new RDFEntities();
var allrows = from s1 in db.RDFMatch_v where s1.RIC.StartsWith(prefixText) select s1.RIC;
return allrows.ToArray();
}
}
}
2012-11-12
Radha
+1
我很想知道为什么你没有考虑jQuery自动完成。 –
+0
你能否给我提供链接,我会试试。 –
+0
http://jqueryui.com/autocomplete/ –