ASP.NET Custom Server Controls: Get in Control of ASP.NET - The server control hierarchy
(Page 2 of 5 )
All ASP.NET sever control classes are implemented in the following namespaces:
- System.Web.UI
- System.Web.UI.HTMLControls
- System.Web.UI.WebControls
All of the above namespaces exist in System.Web.Assembly, which gets automatically added to every ASP.NET web application project in Visual Studio.NET 2003. All server controls get derived directly or indirectly from the System.Web.UI.Control class. Even the “aspx” page (that we design and develop) gets derived from a server control called “Page.”
All of the controls available in System.Web.UI.HTMLControls are mapped directly to HTML tags or elements. All of those controls are appended with the “runat=server” attribute automatically. When we work with System.Web.UI.HTMLControls, we will feel like directly working with HTML. Even though it sounds like a good idea, HTML doesn’t have any object based control of properties (or strong types) to make a developer's life happy when developing the page. The System.Web.UI.WebControls solves this problem by providing an object based interface to HTML elements.
All of the controls in System.Web.UI.WebControls provide a .NET based object model and render themselves as HTML controls. Programming with System.Web.UI.WebControls gives us the flexibility to work with enhanced object based properties, methods and events which are not available in traditional HTML elements. At run-time all these elements get mapped (and exposed) to the proper HTML elements, together with CSS, without our knowledge. Our life becomes very easy when we work with System.Web.UI.WebControls.
Next: Developing a simple custom control >>
More ASP.NET Articles
More By Jagadish Chaterjee