Make sure added [System.Web.Script.Services.ScriptService] into class level of web service
using System;
using System.Collections.Specialized;
using System.Web.Services;
namespace testauto
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class test : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[]
GetCompletionList(string prefixText, int count)
{
StringCollection names = new
StringCollection();
names.Add("a");
names.Add("ab");
names.Add("abc");
names.Add("b");
names.Add("bb");
String[] namesarray = new
String[names.Count];
names.CopyTo(namesarray, 0);
return namesarray;
}
}
}
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<asp:AutoCompleteExtender
ID="TextBox1_AutoCompleteExtender"
runat="server"
TargetControlID="TextBox1"
ServiceMethod="GetCompletionList"
ServicePath="~/test.asmx"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20">
</asp:AutoCompleteExtender>