Jakew
Consulting, hacking, and motorcycles

This is nuts – asp.net user controls

Friday, 6 February 2009 10:32 by jakew

Disclaimer – I did not read the docs before hand.  I was just working in VS.  Maybe this is an RTFM moment.

I’m writing a page that needs to dynamically load a few user controls.  Should have been easy enough.  However, after calling LoadControl none of the child controls in the user control had been setup. 

I was calling Page.LoadControl and passing in the type of user control.  After 3 debug sessions with the same results I changed the code.  Now I’m passing in the path to the user control instead.  It works.

What?  Why did they do that?  Why am I getting different results from the same API based on the type I pass in?

Reading over the MSDN docs there is no indication that there should be a difference in behavior.  The only thing they call out is how events are processed based on when the control is loaded.

Categories:   Tech
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed