Hello and thanks for reading this.
Im trying to use the ajax autocompleteextender. I have installed ajax using the Manage NuGet system in VS13
I have connect everything according to guides but the events dont work at all.
ASP:<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true" /><asp:TextBox runat="server" ID="txtIntervalStudent" /><asp:AutoCompleteExtender runat="server" ID="aceIntervalStudent" ServiceMethod="SearchStudent" TargetControlID="txtIntervalStudent" MinimumPrefixLength="1" CompletionInterval="1000" CompletionSetCount="20" EnableCaching="true" FirstRowSelected="false" /> C#: [System.Web.Script.Services.ScriptMethod()] [System.Web.Services.WebMethod] public static List<string> SearchStudent(string prefixText, int count) { using (SqlConnection conn = new SqlConnection("Data Source=PCM13812;Initial Catalog=KONE;Persist Security Info=True;User ID=sa;Password=c03041988;MultipleActiveResultSets=True;Application Name=EntityFramework")) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT Username FROM [Users] where" + "Username like @Searchtext + '%'"; cmd.Parameters.AddWithValue("@Searchtext", prefixText); cmd.Connection = conn; conn.Open(); List<string> names = new List<string>(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { names.Add(sdr["Username"].ToString()); } } conn.Close(); return names; } } }
What could be the problem?
Thanks alot