I found a working solution here
New solution using javascript not working with auto complete extender not working
This proposed solution is not working
<asp:TextBox ID="CityFetch" placeholder="Start typing the City name" type="text" runat="server" class="form-control" onkeyup="GetCities(this.value)"></asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtenderCity" ServiceMethod="GetCities" TargetControlID="CityFetch" EnableCaching="false" CompletionInterval="1000" MinimumPrefixLength="1" CompletionSetCount="1" runat="server"></asp:AutoCompleteExtender>
<script language="javascript" type="text/jscript">
function GetCities(prefixText, countryCode) {
var countryCode = document.getElementById('<%= EUCountriesDD1.ClientID %>').value;
PageMethods.GetCities(prefixText, countryCode, onSuccess, onError);
}
function onSuccess(cities) {
// Handle the success response
}
function onError(error) {
// Handle the error response
}
</script>
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod()]
public static List<string> GetCities(string prefixText, string countryCode)
{
string strcon = ConfigurationManager.ConnectionStrings["xxxxx=l"].ConnectionString;
//create new sqlconnection and connection to database by using connection string from web.config file
SqlConnection con = new SqlConnection(strcon);
SqlCommand cmd = new SqlCommand("SELECT city FROM EUCities WHERE code = @CountryCode AND city LIKE @CityName + '%'", con);
con.Open();
cmd.Parameters.AddWithValue("@CountryCode", countryCode);
cmd.Parameters.AddWithValue("@CityName", prefixText);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
List<string> cities = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
cities.Add(dt.Rows[i][0].ToString());
}
return cities;
}