Using AJAX Control Toolkit AutoCompleteExtender In ASP.NET 4.5 Web Forms
Hello all,
I have posted in VBForums codebank on how to integrate Ajax Toolkit's AutoCompleteExtender control in your ASP.NET 4.5 Web Forms project. The thread is in VB.NET but if your using C# just replace the code behind as described in Step 4 with the snippet below.
Code Behind
Screenshot
I have posted in VBForums codebank on how to integrate Ajax Toolkit's AutoCompleteExtender control in your ASP.NET 4.5 Web Forms project. The thread is in VB.NET but if your using C# just replace the code behind as described in Step 4 with the snippet below.
Code Behind
private static AdventureWorks2012Entities _context; [ScriptMethod()] [WebMethod] public static List<string> GetCountries(string prefixText, int count) { _context = new AdventureWorks2012Entities(); var result = (from country in _context.CountryRegions.AsEnumerable() where country.Name.ToLower().StartsWith(prefixText, StringComparison.OrdinalIgnoreCase) select country.Name).Take(count); return result.ToList(); } [ScriptMethod()] [WebMethod] public static object GetCountryInfo(string Country) { _context = new AdventureWorks2012Entities(); var result = (from country in _context.CountryRegions.AsEnumerable() where country.Name.ToLower().Equals(Country.ToLower()) select new { country.Name, country.CountryRegionCode }).FirstOrDefault(); return result; }
Screenshot
Comments
Post a Comment