Problem with AutoCompleteExtender control?
Hello Sir i am working in ajax and use AutoCompleteExtender control with WebService. I want to output in single TextBox like when we write A word then all "a" type related record show.
MyWebService:
[WebMethod]
public static List<string> Record (string s)
{
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection("database=asha;server=.;integrated security=true");
SqlCommand cmd = new SqlCommand("select* from manish WHERE Name LIKE '" + s + "%' ", con);
cmd.Parameters.AddWithValue("@Name", s);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> name = new List<string>();
for (int i = 1; i < dt.Rows.Count; i++)
{
name.Add(dt.Rows[i][0].ToString());
}
return name;
}
}
Default.aspx code;
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService.asmx"/>
</Services>
</asp:ScriptManager>
<div>
<asp:TextBox ID="TextBox1"runat="server"></asp:Te
<asp:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"TargetControlID="TextBox1"ServiceMethod="Record"ServicePath="~/WebService.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000" >
</asp:AutoCompleteExtender>
</div>
When we run the program then only textbox show and write any word then no related record find.