ASP.NET CodeBehind and Code Re-Use Using Inheritance
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.