Friday, August 22, 2008

Autocomplete Extender Lesson Learned, Part Two

It turns out that the problems with the AutocompleteExtender actually go even deeper than the dispose problem. Or not as deep, depending on how you think about it. At some point in my effort to make my website pretty, the problem of the extender not extending after a partial postback reappeared. After spending a large, large amount of time on this, I found reference to another bug in the AJAXControlToolKit that happens if you programmatically set the focus back to the textbox associated with the extender control after doing a postback (partial or not).

I removed the set focus statement, and I am back in business. Again.

But dude, seriously?

Friday, August 15, 2008

Converting from a Web Project to Web Site

If you've converted from a VS2008 Web Project to a VS2008 Web Site, and tried to bring pages from one over to the other, you may have been stuck with the issue that your code doesn't see the objects created by the aspx. i.e. the text boxes, the drop downs, etc.

After you spend a while trying to match up namespaces, and letting Resharper fix a bunch of issues for you, you may still be stuck.

Here's one thing to check:

In your page directive, check to see that the compile has chnaged the CodeBehind attribute to read CodeFile. That's got me twice now. That's reason enough to blog about it.

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.

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.