I have went through Joe Stagner's video on implementing an Autocomplete Extender on a textbox, however I cannot get it to work.
Here is my page code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default_AutoComplete.aspx.cs" Inherits="_Default" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title>Untitled Page</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"><Services><asp:ServiceReference Path="AutoComplete.asmx" /></Services></asp:ScriptManager><div> <asp:TextBox runat="server" ID="myTextBox" Width="300"/><ajaxToolkit:AutoCompleteExtender
runat="server"
ID="autoComplete1"
TargetControlID="myTextBox"
ServicePath="AutoComplete.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" /></div></form> </body></html>here is my Webservice
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
public AutoComplete()
{
}
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
Random random = new Random();
List<string> items = new List<string>(count);
for (int i = 0; i < count; i++)
{
char c1 = (char)random.Next(65, 90);
char c2 = (char)random.Next(97, 122);
char c3 = (char)random.Next(97, 122);
items.Add(prefixText + c1 + c2 + c3);
}
return items.ToArray();
}
}When loading the page in a browser I do not get any errors, but when I start typing the autocomplete does not return any suggestions. Do I not have ajax installed properly? I am tried multiple tutorials and am not having any success.
Assistance is much appreciated.
Thanks