ServicePath=""
should be like
ServicePath="AutoComplete.asmx"
Without WebService :
ASP.Net Ajax AutoCompleteExtender Without Using Web Service[
^]
http://www.aspdotnet-suresh.com/2011/05/ajax-autocompleteextender-sample.html[
^]
or else, your code :
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static List<string>GetCompletionList(string prefixText, int count, string contextKey)
{
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select Country from Country where Country like @Name+'%'", con);
cmd.Parameters.AddWithValue("@Name", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> CountryNames = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
CountryNames.Add(dt.Rows[i][1].ToString());
}
return CountryNames;
}