Summary
This chapter begins by looking at the techniques that are available in ASP.NET for creating reusable content and for reducing the amount of repetitive work you need to do when building Web sites and Web applications. While the server-side include approach is still valid, there are better ways. User controls and custom server controls both offer advantages, and they provide a natural approach that integrates well with ASP.NET in both style and effectiveness.
Other techniques briefly discussed in this chapter are using master pages and templates and wrapping existing COM/COM+ components for use in ASP.NET. Chapter 9, "Master Pages, Templates, and Page Subclassing," looks in more depth at the first of these options, but this book does not pursue the COM/COM+ wrapper technique any further.
The second part of this chapter walks through the design and construction of a nontrivial user control that implements a feature that is missing from the standard range of browser-based control elementsa dual-mode combo box. You saw how it uses constituent controls, how to expose properties and methods, and how to use code within the control to manage its behavior and appearance.
Finally, to complete the chapter, you saw how you can use the new ComboBox control in ASP.NET pages. However, this chapter does not address a few issues. One is the way that the client-side script within the control works; we'll come back to this issue in Chapter 6. Another is the general compatibility of the control in different browsers. As you've seen in this chapter, the sample ComboBox control works fine in Internet Explorer 5.0, and it also works well in the latest versions of Opera. However, there are issues in other browsers, especially older ones. In subsequent chapters, you'll see how you must understand the issues, how you can address them, and how you can build controls that adapt to suit a wider range of browser types.