Monday, January 9, 2012

Possible solution for your AJAX AutoCompleteExtender not working

I just ran across an issue in which I couldn't get the AJAX AutoCompleteExtender control to respond when I entered text into the target textbox control. The solution in my case was to uncomment the reference to System.Web.Script.Services.ScriptService in my web service code as follows:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class MySampleWS : System.Web.Services.WebService

To make a long story short, I spent quite a while tweaking the ASP .NET side when the problem was actually in my web service code. Anyway, once I opened up the web service code again and noticed that commented section, I had the problem solved in seconds. Hopefully, this may prove useful to you as well!