I have a textbox with AutoCompleteExtender, instead of using a webservice I just have a method in code behind that pulls a list of string names from an xml. Now every time you start in the text box , the AutoCompleteExtender shows up with all 500 names in it. There is no order either ( ex. if I type "Riha" to start typing "Rihana" you'd think only strings that start with "Riha" would show up, but all 500 show up, not even in any order. I tried setting CompletionSetCount="5" , but no luck. Is there an easy fix to this?
This Part of the Code I believe is functioning properly...
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetNames(string prefixText, int count)
{
XmlDocument xmlArtist = new XmlDocument();
xmlArtist.Load(string.Format(" http://ws.audioscrobbler.com/2.0/?method=chart.gettopartists&api_key={0}&limit=500", key));
List<string> topartists = new List<string>();
foreach (XmlNode node in xmlArtist.SelectNodes("lfm/artists/artist"))
{
topartists.Add(node.SelectSingleNode("name").InnerText.ToString());
}
return topartists;
}
Here is .aspx code
<asp:TextBox ID="txtEnterBand" runat="server" CssClass="txtbox" Width="400px" > </asp:TextBox>
<asp:AutoCompleteExtender ID="txtEnterBand_AutoCompleteExtender" runat="server" TargetControlID="txtEnterBand" ServiceMethod="GetNames" UseContextKey="true" ServicePath="" MinimumPrefixLength="1" CompletionSetCount="5"></asp:AutoCompleteExtender>