“ASP.NET AJAX / UpdatePanel aren’t working…” – this is probably the number one complaint/question found on the ASP.NET AJAX Forums. I decided it would probably be a good idea to discuss some of the common issues I’ve seen:
- xhtmlConformance – This is a common gotcha as described in detail on Scott Guthrie’s blog.
will not work with ASP.NET AJAX. The thing that people often miss with this is sometimes this is set in the server’s machine.config. You can override this setting in your particular application, see MSDN for details. Note, if you aren’t having an issue, there isn’t really a need to set this. However, the settings you want for ASP.NET AJAX are either:
<xhtmlConformance mode="Transitional" />
<xhtmlConformance mode="Strict" />
Installing ASP.NET AJAX – Users often don’t install the ASP.NET AJAX Extensions which is an easy problem to fix. The first thing to check out is the ASP.NET AJAX docs: Installing ASP.NET AJAX. You can download the Extensions on the AJAX Download Page. Remember, these Extensions need to be installed on your web server as well as your development machine. Also, if you are using Visual Studio 2005, you need to have Visual Studio 2005 SP1 installed. SP1 installs the components needed to begin developing with ASP.NET AJAX (such as the UpdatePanel, ScriptManager, etc). Check out the Web Dev Tools blog for the web specific changes in Visual Studio SP1. Note that SP1 is a BIG install; it takes quite a while to install. One other thing to note here, some users are still using the old, pre-release, Atlas UpdatePanel and ScriptManager. It is highly recommended that you upgrade these to at least version 1.0.
Configuring AJAX – Another common issue is attempting to use AJAX goodness on an old, “non-ASP.NET AJAX” site. Basically, unless you create an ASP.NET AJAX Web Site using the new template that Visual Studio SP1 adds (ASP.NET AJAX Enabled Web Application), AJAX will not work without some configuration on your part. All that needs to be done is to modify your web.config file with the specific ASP.NET AJAX settings. Refer to the ASP.NET AJAX docs for more information, specifically Configuring ASP.NET AJAX. If you are having issues with configuring your web.config (for example, this post), my recommendation is to create a new “ASP.NET AJAX Enabled Web Application”, copy the web config and make the specific changes to that copy that you need for your particular site. Then use this web.config in your old site…
Controls Not Compatible w/ UpdatePanel – another very common problem is with controls not operating as expected within the UpdatePanel. Looking at the UpdatePanel Control Overview in the docs, have a look at the section titled “Controls that Are Not Compatible with UpdatePanel Controls”. The most common issue with controls seems to be the Validators. Looking at the docs, you can “fix” the validators by simply setting the EnableClientScript property to “false”. Also there are ASP.NET AJAX compatible validators in the in the works, see Matt Gibbs blog for more information on this.
Well, while this isn’t a complete list of problems that you may find, hopefully it sums up about 90% of them out there. In addition to these issues, I know users have problems with UpdatePanel Triggers, User Controls in UpdatePanels, and UpdatePanels in MasterPages. It’s a good idea to read through the ASP.NET AJAX docs to become familiar with the controls. Also, check out the AJAX Videos which discuss usage of not only the UpdatePanel but also the AJAX Control Toolkit.