Hi,
try like below.
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetSuggessions(string prefixText, int count, string contextKey)
{
List<string> res = MasterDTO.GetCities(21).Select(s => s.CityName).ToList();
string[] suggestions = res.Where(a => a.StartsWith(prefixText)).ToList().ToArray();
return suggestions;
}
because, the web method signature, should be like below.
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetSuggessions(
string prefixText, int count, string contextKey) { ... }
the function should return string array.
refer
AutoComplete Demonstration[
^] for more