BYTE.com > Mr. Computer Language Person > 2004
The Web, with Inheritance
By Martin Heller
July 19, 2004
(The Web, with Inheritance
: Page 1 of 1 )
Readers who have followed me long enough know that my "Programming Windows" column in Windows Magazine, begun in 1992, turned into a "Web Dev" column in 1997, which lasted almost until Windows Magazine folded. I spent a couple of years working on the winmag.com web site, and a couple more years working on PCPitstop.com.
One of the first things I did at each site was to help to set up a template system to insure that the site had a unified look and feel that could be changed easily from a single place, whenever the Powers That Be decided to do a redesign of the site. With the web server technology of the time, the best way to implement a template was to have three standard files that the server included on each page: one for the header section of the page, one for the top and left of the page, and one for the right and bottom of the page. Step one in designing a new page was to copy an empty template page that contained calls to include the three standard files, and start working on the content section in the middle of the page.
When ASP.NET 1.0 came along, server-side includes didn't seem like the best way to achieve a standard look and feel. What I and a lot of other people did instead was to create User Controls (.ASCX files) for the head, top, and bottom sections, and an empty template page that called them all. Step one in designing a new page was to copy an empty template.aspx page and its code-behind file, template.aspx.cs, rename both files, and then change the Codebehind reference in the ASPX Page directive to match the new code-behind file name.
What I really wanted was master pages and visual inheritance. ASP.NET 1.1 didn't have it, either, but ASP.NET 2.0 does. Finally! Basically, you can design a master page, designate areas on the page that are content placeholders, and build content pages that inherit from the master page.
More about ASP.NET 2.0
In addition to master pages, ASP.NET 2.0 supports skins, which are sets of properties and templates for controls, and themes, which are sets of skins, images, and stylesheets.
Page 1 of 1
BYTE.com > Mr. Computer Language Person > 2004
|