ASP.NET CodeBehind and Code Re-Use Using Inheritance
by Kevin Marshall

CodeBehind is when the HTML portion of the page that contains the HTML mark-up and the server side code are separated into two files. This allows designers to make modifications to the HTML without messing up the programmes server side code. It also allows programmers to edit their code without messing up the designers HTML. When the server side code is compiled into an assembly (DLL) each section of the page can even be published to the server separately.

Dreamweaver users do not have native support for CodeBehind like Visual Studio .NET users have, so this article will go some way towards redressing the balance.

This tutorial will guide you through implementing ASP.NET CodeBehind and Code Re-Use techniques using a .NET feature known as Inheritance. You will learn how to define and use your own class files, about re-using and extending existing .NET Classes using Inheritance. For one example the article will outline how to create a new type of Button Server Control that derives from the standard ASP:Button Server Control, and extends its capabilities by adding an “Are you sure you want to do that?” prompt upon clicking the button. You will also learn how to implement CodeBehind in your ASP.NET applications using only Dreamweaver and how to compile your code into assembly (DLL) files.

The following topics will be covered:

  • An introduction to Classes in .NET
  • An introduction to Class Inheritance in .NET
  • An introduction to ASP.NET CodeBehind
  • Implement CodeBehind Classes in a page
  • Utilize Code Re-Use with CodeBehind Classes
  • Extending the Button Server Control
  • Compiling the Button Server Control
  • Using the extended Button Server Control in a page

As usual, Kevin gives his sample code in both C# and VB.NET - the two most-used languages for coding ASP.NET pages.

- OR -

Kevin Marshall

Kevin MarshallI live in Perth, Scotland and am senior programmer with Ltd. I have been involved in computer programming since 1990, web based programming using ASP since 1997 and have been building ASP.NET applications since ASP.NET Beta 2 was released.

I have been an avid Dreamweaver user since Version 1 was launched and with the release of MX have moved into developing extensions. WebXeL run a website dedicated to the development of free and commercial Dreamweaver MX extensions for ASP.NET, the site can be found at

See All Postings From Kevin Marshall >>

Place your review about ASP.NET CodeBehind and Code Re-Use Using Inheritance

You must me logged in to write a review
this is just what i need
January 31, 2006 by Giny Wang

this is just what i need!!

BUT i after i purchaced it, i couldn't download the PDF files.....


This is really very basic...
November 2, 2005 by tony leatham

I assumed that in buying this article I would get some quality content that gave me an efficient way of integrating dreamweaver (for presntation) and (for codebehind).

It doesn't, instead it is a very basic introduction to inheritance in c#.

Waste of money, and I will never by content from this site again

unable to download pdf
January 9, 2005 by steven kitto

this looked like a really good artical. I was just not able to download the pdf file after i paid for it. I tried to contact someone about it and never heard anything back from anyone.

RE: RE: Still full of errors
August 13, 2004 by tom gibbons
There was just one if I rememeber correctly. I don't rememeber off-hand what it was. I'll look over the pdf tomorrow. Not to discourage people from paying for this article. It is worth the money.
See all 8 Reviews