Tim Weaver

A .NET Blog

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

Work

Subscriptions

Post Categories



VS 2005 and Homegrown Master Pages

We have a custom master pages implementation. It relies on a custom base page to handle the templating. We also use base page(s) to handle other shared type logic. I ran the site through VS 2005 migration wizard and quickly realized something was seriously wrong.

I started doing a bunch of different tests to see what the results would be:

  • ASPX Pages that inhert from Page
  • Custom User Control without custom base class
  • ASPX Pages inherit from custom base page
  • Custom User Control that inherits from a base class definated in another assembly
  • Custom User Control inherits from custom base class, which exists in project
 
  Results
The first two tests turned out pretty much as I expected.
The ASPX page was properly converted and the codebehind was turned into a partial class.
The User control was properly converted and the codebehind was turned into a complete class
    I would have thought this would be a partial class, but it was the complete definition.

The ASPX that inherited from a custom base page didn't fare so well. The page was converted and a partial class was created. However, the original base page reference was lost and although the page had the Inherits attribute which pointed to the original base page class name the class wouldn't compile (and obviously none of the custom base page functionality was available).

The Custom User Control that inherits from a base class defined in another assembly had the same issue as the page with a custom base. The original base was lost.

The Custom User Control that inherits from a base class defined in the project worked

  • The base class was moved to the code directory
  • The codebehind was converted to a partial class
  • The page had the Inherits attribute pointed to the base in the code directory
  • Major downside was that you can't tell what a partial class is inherited from without some serious digging or looking at that ascx file

posted on Friday, September 10, 2004 8:51 AM by icodemarine





Powered by Dot Net Junkies, by Telligent Systems