Custom Web Control Development

developed and taught by Microsoft C# MVP, Miguel Castro

In this intense 3-day course, Miguel will teach you to master the art of custom web control development.

Custom WebControl Development Course Outline

 


Course Lab Description

LAB 1

This simple introductory lab will allow the students to drag and drop several controls onto a Webform, set their properties, and observe their behavior. Its purpose is to illustrate the ease of working with visual components in a web deliverable platform in a way that was not possible in the past.

The GalleryBuilder and ListBox Suite are designed to illustrate more complex control with extensive functionality built right in and all complexity invisible to the user.

The Datagrid with the contained SalutationDropdown demonstrates the encapsulation of one control’s responsibilities, eliminating it completely from its parent control and/or the containing Webform.

LAB 2

This lab is inserted in the middle of the introduction talk on purpose. Not only to break up the monotney of a large intro but also to demonstrate the HTML generation purpose behind ASP.NET Webcontrols. The students will use a Textbox control, a Dropdown control, and a Calendar control to see what HTML gets rendered for each despite the small amount of code used at design time.

LAB 3

This lab indoctrinates the students in the techniques used to build the simplest of the three types of controls, Inherited Controls.

Two controls will be built, the ConfirmationButton, which is an extension of the Microsoft Button control, and the SalutationDropdown, a self-filling Dropdown list.

The controls will be built step-by-step starting with the inheritance of the existing controls demonstrating duplicate functionality.

LAB 4

This lab teaches a step by step method of developing a Rendered Control.

The control built is called the FormField control and consist of three primary elements within it, a label, textbox, and button.

The control will start with a simple text rendering and build upon itself with more elements, properties, events, and finally styling.

The elements within this control also demonstrate what it takes to wrap the three most common HTML elements in a Webcontrol: the label for display, the textbox for user input, and the button for action.

LAB 5

This last lab teaches the most straight forward, common, and enjoyable to write custom control, the Composite Control.

The control built here is called he EmailContact control and contains two previously built controls, the ConfirmationButton and the FormField controls.

This control will be built step by step, one child control at a time, demonstrating the high reusability factor in this type of control as well as its resemblance to dynamically created Webforms.

The building of this control will also demonstrate how business functionality can be encapsulated directly in the Webcontrols.


The controls being developed:

ConfirmationButton

This simple Inherited Control extends the ASP.NET Button control to having the ability to popup a confirmation message when pressed.

SalutationDropdown

This Inherited Control extends the ASP.NET DropdownList control to be self filling with a list of common salutations like Mr., Mrs., Ms., and Dr.

FormField

This Rendered Control encapsulates a label, textbox, and button into one control to be used in data entry forms.

EmailContact

This Composite Control builds a commonly used “Contact Us” form allowing a user to fill in some fields and send an email. The email sending functionality is encapsulated directly in this control.