AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=597&pId=-1
Consistent Website Design
page
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 10086/ 16

Introduction

With ASP.NET there come new ways of doing things.  One of these is maintaining a consistent design across your website. This article will go over several methods that are now available to you and the advantages and disadvantages of each.

#Includes

Ah, the good old include file. As easy as -

<!-- #include file|virtual="name.aspx" -->

In ASP these were the most popular to get stuff included into your site and were a good way of doing it. However, they do have limitations.

Pros

  • Simple, quick and easy to implement.
  • Can be used to include dynamic content.
  • Sometimes the only choice when using forms.

Cons

  • Old method and not like the new .NET way of things.
  • Cumbersome to update and keep track of separate files.
  • If you need to add a new include and your site is spread across multiple files, can be a hassle to add the new one.

What I mean by "Sometimes the only choice when using forms" is that when I was creating this site, I have numerous problems when I wanted to have a form on the page (for example the ratings at the bottom), it caused view state errors. The way that I solved this was to use #includes instead and it worked.

Note that you can put ASP.NET stuff in includes and it will work because the ASP.NET processor will process it.

User Controls

This is new to .NET and is quite a good way to wrap functionality into a control and include on a page.

Pros

  • Easy to update and maintain
  • Can have all of the functionality of a ASP.NET Web Form

Cons

  • If you need to add a new control and your site is spread across multiple files, can be a hassle to add the new one
  • Cannot be shared across applications

That last one, "Cannot be shared across applications," can be a problem for some sites. For example, take the old ASPAlliance site.  In order to share that design a web service was implemented because user controls could not be shared to the individual columnist websites because they were different applications.

But user controls are a nice, solid way of encapsulating functionality.

Server.Execute

This is another one what was used back in Classic ASP because of it's ease of use. All you do is -

<% Server.Execute("filepath.aspx") %>

Pros

  • Easy to implement
  • Allows for execution of any ASP.NET pages, not just UI

Cons

  • Can stop forms from working on the page (view state errors)
  • Maintenance hassle.

It is still, however, a good way of putting some quick information on a page (the news on the front page is done this way) but the view state errors are the biggest problem.

Web Services

Web Services are designed for transport of data, but HTML data?

Pros

  • Can be shared across applications (even across websites)

Cons

  • Harder to create and maintain
  • Harder to implement
  • Can become an unnecessary strain

The last one there basically means that dumping a whole lot of data over HTTP/SOAP channels can be a waste when the server can quickly grab the files locally.

Custom Controls

This is new to .NET and is quite a good way to wrap functionality into a control and include on a page.

Pros

  • You can give the code a lot more functionality.
  • Can have all of the functionality of a ASP.NET Web Form

Cons

  • Harder to maintain
  • Harder to update across pages

Custom controls can be good for functionality, but creating and updating all through code can sometimes be a problem.  If you don't need it, why use it?

Page Templates

These templates are another new thing to .NET and can be excellent for formatting the entire page a certain way, always.

Pros

  • Easy to implement (just inherit)
  • Can maintain the same design across the entire site
  • Semi-easy to maintain (100% code, but excellent functionality)

Cons

  • Upgrading old code can be a hassle
  • Sharing across applications can be a hassle.

They aren't perfect, but they are a very good way of getting a standard website across.

Summary

This article has highlighted some of the ways that you can maintain a consistent design across your site and the benefits and disadvantages of each one. Check out the related articles for more information on these methods.


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-26 11:54:53 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search