Friday, August 15, 2008

AJAXToolKit Autocomplete Extender Lesson learned

I was migrating a series of web pages from a small web project in VS2008 to a large client web site (not a web project, a web site). One of these pages included a predicitve text field which I used the ASP.NET AJAXToolKit to implement. The Tool kit worked almost flawlessly. I say almost flawlessly because there is a major bug which prevents the AutoCompleteExtender from working if you host the control in an update panel and you have already done a partial page postback.

Luckily Aaron Schnieder has already solved this issue.
http://weblogs.asp.net/aaronschnieder/archive/2008/03/11/ajaxcontroltoolkit-autocompleteextender-bug-in-an-updatepanel.aspx

Not sure why they haven't kicked out a new version of the tool kit onto Codeplex yet, but they haven't, so you must apply this change yourself.

So after I finished migrating my pages and my web service into the web site, I went to try to run my page with my autocomplete extender, and viola - WTF? Nothing happened. Crap.

Dork around with the pages. Add break points. Google a lot. Did I recently install any VS2008 service packs? Possibly. Uninstall them. Still nothing. Google some more. Add a new web site to my solution, with code right from the AJAXToolKit (converted to VB.NET of course). Still nothing. Two more hours of trial and error. Call it a night.

Log on this morning. Dig in again. More Googling. Hey, what's that? In the new Web Service code behind file I added?

' <System.Web.Script.Services.ScriptService()> _
How come that line is commented out? By default? Yikes.

Remove the comment. Try the app again.

Presto. Back in business.

1 comment:

Helen said...

Thank you so much. It ends my whole day's struggle.