Monday, February 13, 2006

Atlas gotchas

I recently started playing with Atlas, Microsoft's framework for AJAX-like behavior in ASP.NET web applications. First of all, the framework is great, and I've already had a lot of success applying updatePanels to existing web sites.

Let me tell you, though, about the two lines of "code" that had me debugging for 14 hours.

The first problem I encountered was autopostback drop downs doing an asynchronous postback to the server, doing the work (I could see it in the debugger), and then having the results disappear into the ether instead of showing up on the screen. The problem was totally silent and caused no run-time errors of any kind (unless you count not showing the user their data as a run-time error).

This problem was caused by a nondescript piece of html that I had never explicitly written, but was rather leftover from some sort of automatic Visual Studio 2003 template html. My .aspx page had the following line:

<meta name="vs_defaultClientScript" content="JavaScript"/>

Apparently this hijacked Atlas's script handling ability and silently squelched some sort of important behavior that resulted in the above problem. Deleting this line made the problem disappear instantly.

The second problem I had was also related to autopostback drop downs. This time it was when I put an updatePanel in a dynamically added child control. The error here was more obvious. When I changed the value of any autopostback drop down, I received a client-side popup window with the following message:

"An async postback was caused by a control within UpdatePanel '' but the panel could not be found in the page."

After several hours if experimenting with dynamically-added controls (suspecting they were to blame - they were not), I discovered the real problem. Another line of code I never explicitly wrote was breaking Atlas. This time it was in the web.config file. The line was in the portion of the web.config file and looked like this:

<xhtmlconformance mode="Legacy"/>

This beauty of backwards compatibility cost me my whole weekend. Documentation for the element/value pair states that it "Reverts a number of rendering changes made for conformance to the v1.1 rendering behavior." I suspect this line was added by the Visual Studio 2005 migration wizard. Changing the value to "Strict" or "Transitional" (or by deleting the line, which defaults to Transitional) instantly fixes everything.

2 Comments:

At 1:45 PM, Anonymous web hosting service said...

Hi, Just browsing around for ideas for my site. (While we're at the same topic), I'm just getting started if you want to visit:
windows web hosting

Charles

 
At 11:47 PM, Anonymous cpanel hosting webhosting said...

GET WITH IT TODAY

Can I Help You.. Yes If you want to get on the web. If you want to start learning about creating a web site of your own.. go to http://webhost11.com. to find out more about cpanel hosting webhosting ... We can help find a web host for you.

 

Post a Comment

<< Home