Dynamic Data, AJAX and JavaScript errors

The default Dynamic Data application uses AJAX partial rendering (using an UpdatePanel), which make browser post backs feel smoother.  One downside is that it can also make it harder to diagnose some error conditions.

Specifically, while using your application you may run into a JavaScript error that says something cryptic about PageRequestManagerServerErrorException, and generally doesn't relate to your application in a meaningful way.

The purpose of this post is to tell you how to see the real error behind it.  When reporting a Dynamic Data issue, please make sure you always do this as reporting a PageRequestManagerServerErrorException gives little information about what's going on.

Stepping back a little, there are two main categories of errors that your Dynamic Data app can run into:

  1. Errors that get handled by validator controls: those get displayed inside the page, either inline (e.g. in a GridView cell) or at the top of the page (where the asp:ValidationSummary is), or often in both places.
  2. Unhandled errors: those normally result in an ASP.NET runtime error page, which typically have a yellow background and include a clear error message and a stack trace.

The problem is that when using AJAX partial rendering, unhandled errors turn into those cryptic PageRequestManagerServerErrorException, which basically don't tell you what's wrong.

So what should you do about it?   Quite simply, when you run into this, I suggest you temporarily turn off partial rendering so you can see the real error.  To turn it off, open the file Site.master (at the root of the app) and set EnablePartialRendering="false".  Then rerun your scenario using the same step that previously resulted in the JavaScript error.  You should end up with a real ASP.NET error page.

Of course, there is no guarantee that this error will make complete sense, but at least you'll be looking at the real error, and if you report it (e.g. to the forum), there is a good chance that someone can help with it.

When you're done debugging the problem, feel free to set EnablePartialRendering back to true, unless you don't care for it.

As an aside, not that even though I'm writing this in the context of Dynamic Data, everything in this post applies to any ASP.NET application that uses AJAX rendering.  It's just that Dynamic Data has it on by default, and since you didn't have to explicitly turn it on, you may not know that it's happening.

Comments

  • Anonymous
    February 18, 2009
    Please post corrections/new submissions to the Dynamic Data Forum . Put FAQ Submission/Correction in