If the first article,
The Basics of Server Controls, we briefly went over how the user interface in ASP.NET is operated. We also discovered that everything that is parsed in an ASP.NET page is control, or is converted/parsed as a control. However, we looked at a sample which demonstrated that we just reused the Label control. Although not much detail was discussed on the reuse of the Label control, we will discuss that in this article.
As you probably know, the minimal inheritance that you require to create a server control is for the class to inherit (directly or indirectly) from the Control class in the System.Web.UI namespace. Other controls inherit from here but the most other important (or noteworthy control) is also the WebControl class which is found in the System.Web.UI.WebControls namespace. Almost all of our everyday used control that is built-in into the .NET Framework inherits from this class/control.
However, when it comes down to creating our own server controls, we are always faced with decisions of where to start off. We sometimes see a control that we want to modify functionality or behaviour of the normal control. Sometimes, building controls from scratch is the best option but there is still the choice of whether to use the Control class or WebControl class. I will discuss some of the advantages of going each route in this article and look at how each one is achieved.