User Controls and Client Side Scripting
(Page 1 of 3 )
If the requirement is for the appearance (ie, styles) of the form we can adopt XML and XSLT to meet the requirements. If the need comes for functionality we must either rewrite the form code or implement the user controls. User controls provide functionality in different scenes. For example, we are not going to write the database connection info in each page or configuration file, due to the confidential nature of that information. In such cases, user controls come in handy. We can write some secured or encrypted files for the confidential information and use the user controls to read and provide the information as necessary. User controls may provide UI (like tables, text boxes, labels if necessary) or without UI (like database connection string, style etc).
I am going to explain a very simple user control. My user control provides one CheckBox and one TextBox. When I check the checkbox the TextBox background color will be changed. For the sake of explanation I am adding some code to the text box click event also. While writing user controls we must keep in mind the basic principles of creating user controls. Consult your software documentation for more information about those principles.
Next: Starting Our User Control >>
More ASP.NET Code Articles
More By JB Reddy