Introduction
ASP.NET brings a whole new world of functionality, power, and ease of rapid development
for web programmers. Some of these features, such as the advent of code-behind,
are well documented and have become standard practice in everyday development.
Another feature ASP.NET brings us is development with a real, compiled language.
We can now leverage the object-oriented aspects of these new languages and put
them to work in our code. We can take advantage of inheritance, polymorphism,
and encapsulation when writing web apps while still maintaining an Microsoft
DNA-style n-tier architecture.
I'm not going to try to explain these OO design concepts because they are
already the subject of a great many articles (and books). For example, you
could try this article on CodeProject for an introduction.
I will be showing a simple example of how you can use inheritance and encapsulation
in ASP.NET. I will show how you can customize a datagrid by encapsulating some
behavior in a subclass of the datagrid, and thereby making the derived DataGrid
class re-usable across multiple forms or applications. I'll be using C# for
this example, but the same principles apply to VB.NET.