| Foreword | xvii |
| Acknowledgments | xix |
| Introduction | xxi |
| PART I OVERVIEW | |
| 1 ASP.NET Overview | 3 |
| The .NET Framework | 3 |
| The Common Language Runtime | 4 |
| The .NET Framework Class Library | 5 |
| A Quick Tour of ASP.NET | 6 |
| HTTP RuntimeRequest Processing in an ASP.NET Application | 8 |
| Extending ASP.NET | 10 |
| 2 Page Programming Model | 13 |
| A Sample Page | 14 |
| Server Controls | 15 |
| ASP.NET Server Control Hierarchy | 18 |
| ASP.NET Web Controls | 18 |
| Why Write Server Controls? | 19 |
| From Text to Controls | 21 |
| Code Model | 22 |
| Page Execution Model | 23 |
| ASP.NET Pages in a Visual Designer | 26 |
| 3 Component Programming Overview | 29 |
| Managed Component Overview | 30 |
| Properties | 31 |
| The Property Construct | 32 |
| Naming Guidelines for Properties | 36 |
| Advantages of Properties | 36 |
| Methods | 37 |
| Implementing Methods Instead of Properties | 37 |
| Naming Guidelines for Methods and Method Parameters | 38 |
| Events | 39 |
| Delegates | 39 |
| Event Delegates | 42 |
| Raising an Event | 44 |
| Event Sample | 46 |
| Metadata Attributes | 51 |
| Applying Attributes | 52 |
| Designable Components | 53 |
| Controls | 54 |
| PART II SERVER CONTROLSFIRST STEPS | |
| 4 User Controls: From Page to Control | 59 |
| Converting a Page to a User Control | 60 |
| Accessing a User Control from a Page | 62 |
| Reusable User Controls: The SiteHeader and SiteFooter Examples | 64 |
| The User Control Model | 67 |
| User Controls in Visual Studio .NET | 68 |
| Deploying a User Control | 73 |
| An Application-Specific User Control: The CruiseSelector Example | 73 |
| Relative URLs in User Controls | 77 |
| Programmatically Instantiating a User Control | 79 |
| Caching a User Control | 80 |
| VaryByControl Example | 83 |
| How User Control Caching Works | 85 |
| 5 Developing a Simple Custom Control | 87 |
| Server Control Overview | 88 |
| A Trivial Server Control Example | 89 |
| Compiling and Deploying a Server Control | 90 |
| Using a Custom Control on a Page | 92 |
| Exposing a Property: The PrimeGenerator Control Example | 93 |
| Deriving from WebControl | 96 |
| Test Page for the PrimeGenerator Control | 97 |
| Choosing the Base Class for Your Control | 99 |
| Applying Design-Time Attributes | 100 |
| Applying TagPrefixAttribute | 101 |
| Custom Controls in Visual Studio .NET | 102 |
| Adding a Custom Control to the Toolbox | 102 |
| Using Custom Controls from the Toolbox | 103 |
| Customizing the Toolbox Icon | 105 |
| Debugging a Server Control | 106 |
| 6 Custom Controls vs. User Controls | 109 |
| Deployment | 109 |
| Authoring | 110 |
| Content and Layout | 111 |
| Design-Time Behavior | 112 |
| Performance | 112 |
| PART III SERVER CONTROLSNUTS AND BOLTS | |
| 7 Simple Properties and View State | 117 |
| View State and State Management | 118 |
| Using ViewState as the Property StoreThe ViewStateDemoLabel Example | 118 |
| More About View State | 122 |
| Declarative Persistence of Simple Properties | 125 |
| Declarative Syntax for Enumeration Properties | 126 |
| Properties Inherited from Control and WebControl | 127 |
| Control Properties | 127 |
| WebControl Properties | 128 |
| Design-Time Attributes for Properties | 130 |
| Overriding an Attribute | 132 |
| Putting It TogetherThe PageTracker Example | 132 |
| Page That Uses the PageTracker Control | 138 |
| 8 Rendering | 141 |
| Base Classes and Rendering | 142 |
| Rendering Methods of the Control Class | 143 |
| Page Rendering | 144 |
| Overriding RenderThe MetaTag Control Example | 145 |
| HtmlTextWriter and Related Enumerations | 148 |
| HtmlTextWriterTag Enumeration | 149 |
| HtmlTextWriterAttribute Enumeration | 149 |
| HtmlTextWriterStyle Enumeration | 149 |
| Rendering Methods of WebControl | 149 |
| Rendering a Web ControlThe HoverLabel Example | 151 |
| Exercising HtmlTextWriterThe LoginUI Example | 155 |
| Downlevel Rendering | 167 |
| 9 Control Life Cycle, Events, and Postback | 173 |
| Control Life Cycle | 174 |
| Events in Server Controls | 183 |
| Declarative Syntax for Event Wiring | 184 |
| Postback Architecture | 185 |
| Mapping a Postback Event to a Server EventThe IPostBackEventHandler Interface | 186 |
| Implementing IPostBackEventHandlerThe SimpleButton Example | 187 |
| Optimizing Event Implementation | 191 |
| Generating Client-Side Script for Postback | 194 |
| Rendering Multiple Elements That Use Client Script for PostbackThe NavButtons Example | 199 |
| IPostBackDataHandler and Postback Data | 203 |
| Processing Postback DataThe SimpleTextBox Example | 204 |
| Putting It TogetherThe Login Example | 207 |
| Exposing Other Semantic EventsThe HitTracker Example | 212 |
| 10 Complex Properties and State Management | 217 |
| Subproperties | 218 |
| Subproperties Persisted on a Control's Tag | 219 |
| Inner Property Persistence | 220 |
| Properties and Type Converters | 222 |
| Implementing a Type Converter | 223 |
| Putting It TogetherThe MapDemo Example | 236 |
| State Management, IStateManager, and the ViewState Dictionary | 245 |
| How a Page Serializes and Restores Its View State | 245 |
| The IStateManager Interface | 246 |
| The ViewState Property and Default State Management | 247 |
| Implementing IStateManager in a Custom Type | 249 |
| Collection PropertiesThe ImageMap Example | 255 |
| Implementing State Management in a Collection TypeThe HotSpotCollection Example | 264 |
| Expando AttributesThe IAttributeAccessor Interface | 271 |
| 11 Styles in Control | 275 |
| Styles Overview | 275 |
| Overriding Style PropertiesThe Spreadsheet Example | 279 |
| Implementing a Custom Typed StyleThe MyPanelStyle Example | 283 |
| 12 Composite Controls | 293 |
| Composite ControlsKey Concepts | 294 |
| Implementing a Composite ControlThe CompositeLogin Example | 296 |
| APIs Related to Composite Controls | 308 |
| View State and Child Controls | 310 |
| Event Bubbling | 311 |
| Styles in Composite ControlsThe StyledCompositeLogin Example | 313 |
| Templated Controls Overview | 320 |
| Implementing a Templated ControlThe ContactInfo Example | 321 |
| Control Parsing and Control Builders | 331 |
| 13 Client-Side Behavior | 339 |
| Browser Capabilities and Client-Side Behavior | 340 |
| Client Script-Related API | 341 |
| Using Client Script and DHTML | 342 |
| Deploying Client Files | 343 |
| Putting It TogetherThe HtmlEditor Example | 345 |
| 14 Validator Controls | 359 |
| Validation ArchitectureIValidator, BaseValidator, and CustomValidator | 360 |
| The Validation Framework | 362 |
| Validator Controls Provided by ASP.NET | 362 |
| Using Validation in a Page | 362 |
| How the Page Performs Validation | 363 |
| Client-Side Validation | 364 |
| The ValidationSummary Control | 364 |
| Validating Text EntryThe StringValidator Example | 365 |
| 15 Design-Time Functionality | 375 |
| .NET Framework Design-Time Architecture | 376 |
| Type Converters | 380 |
| TypeConverterAttribute | 381 |
| Designers | 381 |
| Composite Control DesignersThe CompositeControlDesigner Example | 384 |
| Templated Control DesignersThe ContactInfoDesigner Example | 386 |
| Read-Write Control DesignersThe ScrollablePanelDesigner Example | 394 |
| Designer Verbs | 399 |
| DesignerAttribute | 399 |
| UI Type Editors | 401 |
| String Editor Example | 401 |
| Collection Editor Examples | 406 |
| EditorAttribute | 407 |
| Component Editors | 408 |
| The MyLabelComponentEditor Example | 408 |
| Designer Verb That Initiates Component Editing | 415 |
| Debugging Design-Time Code | 418 |
| 16 Data-Bound Controls | 421 |
| Data Binding Overview | 422 |
| BindableAttribute and the DataBindings Property | 424 |
| Implementing a Data-Bound Control | 424 |
| The DataSource Property and Related Members | 433 |
| Creating the Control HierarchyDataBind and CreateChildControls | 434 |
| Styles and Rendering | 436 |
| Implementing a Data-Bound Control Designer | 442 |
| 17 Localization, Licensing, and Other Miscellany | 451 |
| Localization | 451 |
| Using Resources in Controls | 452 |
| Embedding and Accessing Resources | 456 |
| Localizing Metadata Attributes | 460 |
| Licensing | 463 |
| ServerLicenseProvider | 467 |
| ExpiringLicenseProvider | 473 |
| EncryptedLicenseProvider | 475 |
| Configurable Properties | 477 |
| Deployment | 483 |
| PART IV SERVER COMPONENTS | |
| 18 XML Web Services | 489 |
| XML Web Services Overview | 489 |
| Developing an XML Web ServiceThe StockWebService Example | 490 |
| Implementing the Web Service | 491 |
| Deploying the Web Service | 497 |
| Developing Web Service Client Proxies | 499 |
| XML Web Service-Based Server ControlsThe StockGrid Example | 500 |
| Implementing the Server Control | 502 |
| Implementing the Control Designer | 515 |
| 19 HTTP Handlers | 519 |
| HTTP Handler Overview | 519 |
| The IHttpHandler Interface | 521 |
| The IHttpHandlerFactory Interface | 522 |
| The "Hello, World" HTTP Handler Example | 522 |
| Handling a New ExtensionThe XmlHandler Example | 525 |
| Dynamic ImagesThe ImageLabelHandler Example | 532 |
| The ImageLabel Control and Designer | 538 |
| HTTP Handlers and Session State | 548 |
| PART V SERVER CONTROL CASE STUDIES | |
| 20 Data-Bound Templated Controls | 553 |
| The ListView Control | 554 |
| ListView Specification | 557 |
| ListView Implementation | 558 |
| Data-Bound Controls | 559 |
| Templates | 568 |
| Styles and State Management | 571 |
| Rendering | 575 |
| Events | 580 |
| Client Script Functionality | 585 |
| Design-Time Attributes | 587 |
| Designer Implementation | 590 |
| 21 DHTML-Based Server Controls | 603 |
| The DatePicker Control | 604 |
| DatePicker Specification | 607 |
| DatePicker and DatePickerDesigner Implementation | 608 |
| Composite Control | 608 |
| Delegated Properties | 610 |
| Styles and State Management | 612 |
| Client Script Functionality | 615 |
| Rendering | 620 |
| Events | 622 |
| Validation | 624 |
| Design-Time Attributes | 625 |
| Designer Implementation | 627 |
| PART VI APPENDIXES | |
| A Metadata Attributes | 633 |
| B Object Model for Common Classes | 643 |
| C Microsoft ASP.NET Web Matrix | 653 |
| INDEX | 661 |