Chapter 18: Building ASP.NET Server Controls


Overview

Since the early days, COM developers around the world have been building reusable visual controls. In the early 90's, building such controls required significant time and investment in understanding the myriad of COM interfaces that a control had to implement and use.

Later in the decade , C/C++ Frameworks like the Microsoft Foundation Classes ( MFC ) and the Active Template Library ( ATL ) made control development a little easier. They provided reusable classes and templates that implemented a lot of plumbing code required for controls. But the true breakthrough in popular control development didn't really happen until 1996, when the release of the Visual Basic Control Creation edition made control creation far simpler, and consequently very popular globally.

The upside of control development, and the reason why people still write so many controls today, is reusability. Once you have conquered visual control development, the reward of being able to write a control once (the grid control being the canonical example) and then reuse it in numerous control containers (such as Word and Excel) makes it worth all the pain. You can, of course, reuse the control in your own suite of products, not to mention that you could make a good living selling them to other developers. These same advantages apply in the world of ASP.NET controls, but there is one big difference: ASP.NET controls are easy to get started with .

ASP.NET allows you to build reusable visual controls that can render themselves as HTML or any other markup language such as WML. Many high-level similarities can be drawn between COM controls and ASP.NET controls, as they both enable reuse within UIs. But in reality, they are very different in the way they are implemented. ASP.NET provides a clean and easy-to-use class hierarchy for implementing controls, and there are no esoteric interfaces or threading models that are difficult to understand. ASP.NET still uses interfaces, but there really aren't more than a couple you'll use on a regular basis.

In this chapter, we'll look at ASP.NET control development covering:

  • When, why, and how to build ASP.NET controls in both Visual Basic .NET and C#

  • How controls form the basis of all page-rendering in ASP.NET

  • How controls persist state across page invocation

  • How controls interact with postback and can raise events.\

  • Building controls that themselves use other controls to render their UI




Professional ASP. NET 1.1
Professional ASP.NET MVC 1.0 (Wrox Programmer to Programmer)
ISBN: 0470384611
EAN: 2147483647
Year: 2006
Pages: 243

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net