So i had a page that i needed to drop back into a compiled assembly, rather than just having it as a partial class next to the aspx file. This is always good, as you get compile support in the assembly. The only hard part is decalring all the controls you reference in the file as protected. Then i created a skeleton class that just extended the one from the assembly.
Trouble was that all the control definitions in the base class didn't get wired up. You know how it goes with the protected variables. So i spent a whilte trying public, didn't work. Reading blogs suggested using master pages.. Then Scott Allen on Rick Strahl's blog came to the rescue with the CodeFileBaseClass attribute on the page directive.
Nice. Rick's blog
Heres an example: jotek's sample