# Thursday, November 15, 2007
I know it's been a bit quiet hereabouts of late.  I'm in the middle of a writing project, as well as a (relatively) new work situation still, and trying to catch up from the fact that my knowledge of ASP.NET basically consisted of "there's code behind" before.  So far my feelings are mixed.  Sometimes I think ASP.NET if pretty darned clever.  Other days I find myself longing for the days of CGI, when at least it was easy to understand what was supposed to happen.  Those days usually have something to do with viewstate. :-)  Anyway...

I've also been learning about the ASP.NET Ajax goodies, and ran into an interesting problem.  If you are using UpdatePanel, you absolutely cannot mess with the control hierarchy after the update panel has been created.  If you do, you'll be presented with an helpful error that basically reads "you've screwed something up!".  It took a while to get to the root of the problem given that input.  Turned out that the update panel was in markup for my page, but somewhere between when it got created and OnInit for the page, the control hiearchy was being changed.  I won't go into detail about how, but suffice it to say stuff in the page got wrapped with some other stuff, thereby changing the hierarchy.  Nobody else seemed to mind, except for the updatepanel.  Too make a potentially very long story only slightly long, as long as all of the screwing around with the controls is done in or prior to OnPreInit for the page, all is well.  Once that change was made everything was happy, and the update panels work fine. 

The page lifecycle is possibly one of the great mysteries of our time...

Friday, November 16, 2007 10:15:33 AM (Pacific Standard Time, UTC-08:00)
I feel your pain Patrick! After more than three years of mostly ASP.NET programming, there are still mysteries I can't explain, although my "try-this" cache has grown considerably. I've sort of gone in the other direction, joining the Shared Services group here at Ckfr and am just wrapping up a solution to a .NET runtime load issue involving COM and managed C++. Having a good time away from the UI.

Saturday, November 17, 2007 9:47:30 AM (Pacific Standard Time, UTC-08:00)
if this is the register error that occurs at the end of the page cycle, then you're right: it's associated with adding/removing the panel during its life cicle. anyway, you shouldn't have problems if you add/remove/add again until the end of the init event...
Comments are closed.