Using Master Pages as Templates in ASP.Net WebForms – Introduction

Posted on February 3, 2011 
Filed Under .Net Code, Web Development

I maintain a fairly simple CMS that our customers use for their public facing web site. Most of the CMS is pretty straight forward. Create, publish, edit content, etc. I took over this project as it was originally designed by an outside contractor. For the most part, the meat of the application is the same, aside from some changes here and there to optimize code reuse, optimize performance, add features, etc.

Since this CMS was designed to be installed as public facing sites, it was built to have templates so that each site could maintain their own unique look and feel. This was done in a pretty standard way that most ASP.Net sites are created. The site is created with a master page that helps maintain the same look and feel through the whole site and then in the App_Themes folder, the CSS files change the way the site looks. Code was added so that the theme can be switched on the fly.

This worked excellent for many years, however recently we had been getting many requests on completely changing the layout and placing content in places that were not designed to have content. Others wanted their main content to look much different than what we could support.

So, I set out to devise a way of doing templates that would allow the web designer complete control over the site templates. This small series is going to show (in a simplified way, mind you) how I built the new templates to give the web designer more control over the overall design of the site.

As I add posts to the series, I will add them to the bottom of this post.

ASP.Net Web Forms Templates – Part 1

Comments

One Response to “Using Master Pages as Templates in ASP.Net WebForms – Introduction”

  1. ASP.Net Web Forms Templates – Part 1 : TheCodeMonk on February 3rd, 2011 12:30 am

    [...] and css files so that different templates can be used. The problem with this, as I outlined in the introduction, if you set up a master page, there isn’t much you can do to change the complete layout of [...]

Leave a Reply