AutoCompleteExtender not suggesting search terms
- by Phil
My codebehind method:
<System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
' Create array of movies
Dim movies() As String = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"}
' Return matching movies
Return From m In movies Where (m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase)) Select m _
.Take(count).ToArray()
End Function
End Class
Then in my aspx page I have:
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server"
DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
ServicePath="" TargetControlID="TextBox1" UseContextKey="True" MinimumPrefixLength="2">
</asp:AutoCompleteExtender>
</div>
</form>
When I run the page there are no errors, but there also are no auto complete suggestions. Please help!