Developing a Wonderful ASP.NET TextField Control
(Page 1 of 4 )
This article introduces you to the concept of the User Control. It also walks you through the development of a well-featured TextField control with several functionalities.
A
downloadable zip file is available for this article.
The entire solution (source code) for this article is available as a free download in the form of a zip, as shown above. The source code in this article has been developed using Microsoft Visual Studio 2005 Professional Edition on Microsoft Windows Server 2003 Standard Edition. I didn't really test any of the code in any other tools/IDEs/servers/editions/versions. If you have any problems, please feel free to post in the discussion area.
Introduction
ASP.NET contains a control framework that is used by developers to create different user interfaces for their web applications. This framework is often referred to as web forms. The controls related to web forms are generally termed server controls.
The server control architecture is extensible; component developers design and implement new server controls. These new server controls are categorized into "User Controls" and "Custom Controls." Any of these controls are generally the extensions of existing server controls or extensions to the "Control" base class. Each of these controls gets converted to HTML tags at run time. This hides all the complexities and inconsistencies of any browser used for browsing the web application.
Several of these controls are made up of different properties, methods and events. These controls may also use "View State" to manage the state of server controls across individual web requests. Managing the state can be understood as "remembering the values or choices of the user across multiple requests of several pages."
Coming to the difference between a "User Control" and a "Custom Control," a "User Control" simply behaves like an include file with an ASCX extension. User controls are little more than a snippet of a web page that can be dragged and dropped onto the same web page for any number of times. They can be easily reused across any number of pages.
A "Custom Control" is a compiled code component and a lot more than a user control. A custom control is more complex to create when compared to a user control. When developing a custom control, you take hold of the control completely for both design time and run time execution. It gives you WYSISWYG features along with design time customization. You may have to emit lot of HTML and JavaScript depending upon the flavors of the features you require.
I already contributed a few articles on developing different types of custom controls on this same web site. You can have a look at http://www.aspfree.com/cp/bio/Jagadish-Chatarji.
Next: Developing your own flexible Textbox control with new features: identifying requirements >>
More ASP.NET Articles
More By Jagadish Chaterjee