Monday, October 29, 2007

appendChild fails when using ASP.NET AJAX library

I was struck with a strange behavior when using the ASP.NET AJAX library.

I have a time-proved control that uses AJAX (hand-made) to query a database to retrieve the data as the user types, in other words, an auto complete text box. Multi column, themeable, the works.

Anyway, recently I used this control inside an ASP.NET AJAX UpdatePanel because I needed the ability to hide or display this control in a post back event without refreshing the whole page.

Well, this control of mine creates an hidden DIV that it appends to the body of the document on its initialization phase. However, when loading the page, the entire page fails with an JavaScript exception and the browser navigates to an exception page.

With a lot of tries and errors I managed to work around the issue, but the problem remains.

One other thing I noticed is that for some reason the UpdatePanel has a different hierarchy than the rest of the page.

I don't have time right now to pursue why the ASP.NET AJAX library behaves like this, but I'll look into it in the future.


Post a Comment