You are previewing ASP.NET 4 24-Hour Trainer.
O'Reilly logo
ASP.NET 4 24-Hour Trainer

Book Description

This unique book-and-video package introduces ASP.NET 4 to programmers

Microsoft ASP.NET allows you to build dynamically generated Web pages from database content. Written by a well-known authority on ASP.NET, this book-and-video package is an ideal place to start learning about the capabilities of ASP.NET 4. Each lesson covers both the ASP.NET Web Forms Framework and the ASP.NET MVC 2 Framework and is designed to teach you the fundamentals of the topic before progressing to a step-by-step tutorial. An instructional video for each of the 48 tutorials is provided on the video that accompanies the book.

ASP.NET 4 24-Hour Trainer is an exceptional book-and-video package ideal for everyone from beginners to more advanced developers.

Table of Contents

  1. Copyright
  2. ABOUT THE AUTHOR
  3. CREDITS
  4. ACKNOWLEDGMENTS
  5. PREFACE
    1. WHO THIS BOOK IS FOR
    2. HOW THIS BOOK IS STRUCTURED
    3. WHAT THIS BOOK COVERS
    4. INSTRUCTIONAL VIDEOS ON DVD
    5. CONVENTIONS
    6. SUPPORTING WEB SITES AND CODE
    7. ERRATA
    8. P2P.WROX.COM
  6. Welcome
    1. WEB DEVELOPMENT 101
    2. ASP.NET FRAMEWORK
      1. ASP.NET Web Forms Framework
      2. ASP.NET MVC Framework
      3. Web Forms vs. MVC
    3. GETTING STARTED
      1. Microsoft Visual Web Developer 2010 Express Setup
  7. I. Introduction to Web Development
    1. 1. Anatomy of an HTML Page
      1. 1.1. DOCTYPE DECLARATION
      2. 1.2. HTML ELEMENT
        1. 1.2.1. Head Element
        2. 1.2.2. Body Element
        3. 1.2.3. Syntax
      3. 1.3. TRY IT
        1. 1.3.1. Lesson Requirements
        2. 1.3.2. Hints
        3. 1.3.3. Step-by-Step
    2. 2. Using Common HTML Tags
      1. 2.1. HEADINGS
      2. 2.2. DIVIDING TEXT
      3. 2.3. LISTS
      4. 2.4. LINKS
      5. 2.5. IMAGES
      6. 2.6. TABLES
      7. 2.7. FORMS
      8. 2.8. TRY IT
        1. 2.8.1. Lesson Requirements
        2. 2.8.2. Hints
        3. 2.8.3. Step-by-Step
    3. 3. Adding Style to an HTML Page
      1. 3.1. CSS RULES
        1. 3.1.1. Class Selectors
        2. 3.1.2. ID Selectors
      2. 3.2. CREATING AND MODIFYING CSS RULES
      3. 3.3. APPLYING CSS RULES
      4. 3.4. MANAGING CSS RULES
      5. 3.5. TRY IT
        1. 3.5.1. Lesson Requirements
        2. 3.5.2. Hints
        3. 3.5.3. Step-By-Step
    4. 4. State Management in ASP.NET 4
      1. 4.1. SESSION ID
      2. 4.2. COOKIES
      3. 4.3. SESSION OBJECT
      4. 4.4. PROFILE OBJECT
      5. 4.5. TRY IT
        1. 4.5.1. Lesson Requirements
        2. 4.5.2. Hints
        3. 4.5.3. Step-By-Step
    5. 5. Configuring Your Web Application
      1. 5.1. WEB CONFIGURATION FILES
      2. 5.2. ASP.NET WEB SITE ADMINISTRATION TOOL
      3. 5.3. PROGRAMMATICALLY READING A WEB.CONFIG FILE
      4. 5.4. TRY IT
        1. 5.4.1. Lesson Requirements
        2. 5.4.2. Hints
        3. 5.4.3. Step-By-Step
  8. II. Getting Started
    1. 6. Web Site Projects vs. Web Application Projects
      1. 6.1. WEB SITE PROJECTS
      2. 6.2. WEB APPLICATION PROJECTS
      3. 6.3. WEB SITE PROJECTS VS. WEB APPLICATION PROJECTS
      4. 6.4. TRY IT
        1. 6.4.1. Lesson Requirements
        2. 6.4.2. Hints
        3. 6.4.3. Step-By-Step
    2. 7A. Your First ASP.NET Web Forms Web Application
      1. 7A.1. THE SAMPLE ASP.NET WEB FORMS APPLICATION
      2. 7A.2. STRUCTURE OF A WEB FORMS APPLICATION
      3. 7A.3. COMPONENTS OF A WEB FORM
      4. 7A.4. TRY IT
        1. 7A.4.1. Lesson Requirements
        2. 7A.4.2. Hints
        3. 7A.4.3. Step-By-Step
    3. 7B. Your First ASP.NET MVC Web Application
      1. 7B.1. THE SAMPLE ASP.NET MVC APPLICATION
      2. 7B.2. STRUCTURE OF AN MVC APPLICATION
      3. 7B.3. COMPONENTS OF AN MVC PAGE
      4. 7B.4. TRY IT
        1. 7B.4.1. Lesson Requirements
        2. 7B.4.2. Hints
        3. 7B.4.3. Step-By-Step
    4. 8A. The Page Life Cycle in Web Forms
      1. 8A.1. PAGE-LEVEL TRACING
      2. 8A.2. APPLICATION-LEVEL TRACING
      3. 8A.3. ISPOSTBACK PROPERTY
      4. 8A.4. TRY IT
        1. 8A.4.1. Lesson Requirements
        2. 8A.4.2. Hints
        3. 8A.4.3. Step-By-Step
    5. 8B. The Request Life Cycle in MVC
      1. 8B.1. ROUTING
      2. 8B.2. THE CONTROLLER
      3. 8B.3. THE MODEL
      4. 8B.4. THE VIEW
      5. 8B.5. HTTP VERBS
      6. 8B.6. TRY IT
        1. 8B.6.1. Lesson Requirements
        2. 8B.6.2. Hints
        3. 8B.6.3. Step-By-Step
  9. III. Developing Forms and Views
    1. 9A. Server Controls in Web Forms
      1. 9A.1. SERVER CONTROL CATEGORIES
      2. 9A.2. SIMPLE SERVER CONTROLS
      3. 9A.3. COMPLEX SERVER CONTROLS
      4. 9A.4. TRY IT
        1. 9A.4.1. Lesson Requirements
        2. 9A.4.2. Hints
        3. 9A.4.3. Step-By-Step
    2. 9B. HTML Helpers in MVC
      1. 9B.1. STANDARD HTML HELPERS
      2. 9B.2. STRONGLY-TYPED HTML HELPERS
      3. 9B.3. TRY IT
        1. 9B.3.1. Lesson Requirements
        2. 9B.3.2. Hints
        3. 9B.3.3. Step-By-Step
    3. 10A. View State in Web Forms
      1. 10A.1. VIEWING VIEW STATE
      2. 10A.2. DISABLING VIEW STATE
      3. 10A.3. TRY IT
        1. 10A.3.1. Lesson Requirements
        2. 10A.3.2. Hints
        3. 10A.3.3. Step-By-Step
    4. 10B. Custom HTML Helpers in MVC
      1. 10B.1. CREATING AN HTML HELPER
      2. 10B.2. CREATING AN HTMLHELPER EXTENSION METHOD
      3. 10B.3. TRY IT
        1. 10B.3.1. Lesson Requirements
        2. 10B.3.2. Hints
        3. 10B.3.3. Step-By-Step
  10. IV. Maintaining a Consistent Page Layout
    1. 11. Master Pages
    2. 11A. Master Pages in Web Forms
      1. 11A.1. MASTER PAGES
      2. 11A.2. CONTENT PAGES
      3. 11A.3. NESTED MASTER PAGES
      4. 11A.4. THE MASTER PROPERTY
      5. 11A.5. TRY IT
        1. 11A.5.1. Lesson Requirements
        2. 11A.5.2. Hints
        3. 11A.5.3. Step-by-Step
    3. 11B. Master Pages in MVC
      1. 11B.1. MASTER PAGES
      2. 11B.2. CONTENT PAGES
      3. 11B.3. NESTED MASTER PAGES
      4. 11B.4. UPDATING MASTER PAGE CONTENT
      5. 11B.5. TRY IT
        1. 11B.5.1. Lesson Requirements
        2. 11B.5.2. Hints
        3. 11B.5.3. Step-by-Step
    4. 12A. Skins and Themes in Web Forms
      1. 12A.1. THEMES
      2. 12A.2. SKINS
      3. 12A.3. APPLYING THEMES
      4. 12A.4. TRY IT
        1. 12A.4.1. Lesson Requirements
        2. 12A.4.2. Hints
        3. 12A.4.3. Step-by-Step
    5. 12B. Design Templates in MVC
      1. 12B.1. TRY IT
        1. 12B.1.1. Lesson Requirements
        2. 12B.1.2. Hints
        3. 12B.1.3. Step-by-Step
    6. 13A. User Controls in Web Forms
      1. 13A.1. CREATING A USER CONTROL
      2. 13A.2. REGISTERING A USER CONTROL
      3. 13A.3. ACCESSING CONTROLS IN A USER CONTROL
      4. 13A.4. TRY IT
        1. 13A.4.1. Lesson Requirements
        2. 13A.4.2. Hints
        3. 13A.4.3. Step-by-Step
    7. 13B. Partial Views in MVC
      1. 13B.1. CREATING A PARTIAL VIEW
      2. 13B.2. RENDERING A PARTIAL VIEW
      3. 13B.3. TRY IT
        1. 13B.3.1. Lesson Requirements
        2. 13B.3.2. Hints
        3. 13B.3.3. Step-by-Step
  11. V. Controlling the Flow
    1. 14A. Event Model in Web Forms
      1. 14A.1. TRY IT
        1. 14A.1.1. Lesson Requirements
        2. 14A.1.2. Hints
        3. 14A.1.3. Step-by-Step
    2. 14B. Controllers in MVC
      1. 14B.1. ACTION METHODS
      2. 14B.2. PASSING DATA TO THE VIEW
      3. 14B.3. ACTION FILTERS
      4. 14B.4. CONTROLLER METHODS
      5. 14B.5. RETRIEVING DATA FROM THE REQUEST
      6. 14B.6. CREATING A CONTROLLER
      7. 14B.7. TRY IT
        1. 14B.7.1. Lesson Requirements
        2. 14B.7.2. Hints
        3. 14B.7.3. Step-by-Step
    3. 15. URL Routing Overview
    4. 15A. URL Routing in Web Forms
      1. 15A.1. TRY IT
        1. 15A.1.1. Lesson Requirements
        2. 15A.1.2. Hints
        3. 15A.1.3. Step-by-Step
    5. 15B. URL Routing in MVC
      1. 15B.1. TRY IT
        1. 15B.1.1. Lesson Requirements
        2. 15B.1.2. Hints
        3. 15B.1.3. Step-by-Step
  12. VI. Validating User Input
    1. 16A. Validation Controls in Web Forms
      1. 16A.1. REQUIREDFIELDVALIDATOR
      2. 16A.2. COMPAREVALIDATOR
      3. 16A.3. REGULAREXPRESSIONVALIDATOR
      4. 16A.4. RANGEVALIDATOR
      5. 16A.5. VALIDATIONSUMMARY
      6. 16A.6. TRY IT
        1. 16A.6.1. Lesson Requirements
        2. 16A.6.2. Hints
        3. 16A.6.3. Step-By-Step
    2. 16B. Validation Helpers in MVC
      1. 16B.1. VALIDATION HELPERS
      2. 16B.2. MODEL BINDING
      3. 16B.3. VALIDATION SUMMARY
      4. 16B.4. RENDERING VALIDATION ERRORS
      5. 16B.5. TRY IT
        1. 16B.5.1. Lesson Requirements
        2. 16B.5.2. Hints
        3. 16B.5.3. Step-by-Step
    3. 17A. Custom Validators in Web Forms
      1. 17A.1. TRY IT
        1. 17A.1.1. Lesson Requirements
        2. 17A.1.2. Hints
        3. 17A.1.3. Step-by-Step
    4. 17B. Data Annotation Validators in MVC
      1. 17B.1. TRY IT
        1. 17B.1.1. Lesson Requirements
        2. 17B.1.2. Hints
        3. 17B.1.3. Step-by-Step
  13. VII. Reading and Displaying Data
    1. 18. Using the ADO.NET Entity Framework
      1. 18.1. CREATING A SQL SERVER DATABASE
      2. 18.2. CREATING AN ENTITY DATA MODEL
      3. 18.3. LINQ TO ENTITIES
      4. 18.4. TRY IT
        1. 18.4.1. Lesson Requirements
        2. 18.4.2. Hints
        3. 18.4.3. Step-by-Step
    2. 19A. Displaying Data in Web Forms
      1. 19A.1. REFERRING TO THE DATA LAYER
      2. 19A.2. LIST CONTROLS
      3. 19A.3. TABULAR CONTROLS
      4. 19A.4. NESTING CONTROLS
      5. 19A.5. TRY IT
        1. 19A.5.1. Lesson Requirements
        2. 19A.5.2. Hints
        3. 19A.5.3. Step-by-Step
    3. 19B. Displaying Data in MVC
      1. 19B.1. REFERRING TO THE DATALAYER
      2. 19B.2. USING VIEWDATA
      3. 19B.3. USING STRONGLY-TYPED VIEWS
      4. 19B.4. TRY IT
        1. 19B.4.1. Lesson Requirements
        2. 19B.4.2. Hints
        3. 19B.4.3. Step-by-Step
    4. 20A. Using GridView in Web Forms
      1. 20A.1. FORMATTING THE GRIDVIEW
      2. 20A.2. EDITING COLUMNS
      3. 20A.3. USING TEMPLATED FIELDS
      4. 20A.4. DATASOURCE CONTROLS
      5. 20A.5. TRY IT
        1. 20A.5.1. Lesson Requirements
        2. 20A.5.2. Hints
        3. 20A.5.3. Step-by-Step
    5. 20B. Managing Data in MVC
      1. 20B.1. ADDING RECORDS
      2. 20B.2. EDITING RECORDS
      3. 20B.3. DELETING RECORDS
      4. 20B.4. TRY IT
        1. 20B.4.1. Lesson Requirements
        2. 20B.4.2. Hints
        3. 20B.4.3. Step-by-Step
  14. VIII. Managing Data
    1. 21A. Dynamic Data in Web Forms
      1. 21A.1. THE DYNAMIC DATA ENTITIES WEB APPLICATION TEMPLATE
      2. 21A.2. PAGE TEMPLATES
      3. 21A.3. DYNAMIC DATA FOLDER STRUCTURE
      4. 21A.4. PARTIAL CLASSES
      5. 21A.5. TRY IT
        1. 21A.5.1. Lesson Requirements
        2. 21A.5.2. Hints
        3. 21A.5.3. Step-by-Step
    2. 21B. Display Templates in MVC
      1. 21B.1. THE DISPLAYFORMODEL HELPER
      2. 21B.2. CUSTOM DISPLAY TEMPLATES
      3. 21B.3. TRY IT
        1. 21B.3.1. Lesson Requirements
        2. 21B.3.2. Hints
        3. 21B.3.3. Step-by-Step
    3. 22A. Dynamic Data Templates in Web Forms
      1. 22A.1. PAGE TEMPLATES
      2. 22A.2. CUSTOM PAGE TEMPLATES
      3. 22A.3. FIELD TEMPLATES
      4. 22A.4. CUSTOM FIELD TEMPLATES
      5. 22A.5. TRY IT
        1. 22A.5.1. Lesson Requirements
        2. 22A.5.2. Hints
        3. 22A.5.3. Step-by-Step
    4. 22B. Editor Templates in MVC
      1. 22B.1. THE EDITORFORMODEL HELPER
      2. 22B.2. CUSTOM EDITOR TEMPLATES
      3. 22B.3. TRY IT
        1. 22B.3.1. Lesson Requirements
        2. 22B.3.2. Hints
        3. 22B.3.3. Step-by-Step
  15. IX. Client-side Programming
    1. 23. JavaScript
      1. 23.1. HOW TO USE JAVASCRIPT
      2. 23.2. JAVASCRIPT SYNTAX
      3. 23.3. DOCUMENT OBJECT MODEL
      4. 23.4. JQUERY
        1. 23.4.1. Microsoft Ajax Content Delivery Network
        2. 23.4.2. jQuery Selectors
        3. 23.4.3. jQuery Attributes
        4. 23.4.4. jQuery Effects
        5. 23.4.5. jQuery Event Helpers
      5. 23.5. TRY IT
        1. 23.5.1. Lesson Requirements
        2. 23.5.2. Hints
        3. 23.5.3. Step-by-Step
    2. 24A. Using the AJAX Extensions in Web Forms
      1. 24A.1. AJAX EXTENSIONS CONTROLS
        1. 24A.1.1. UpdatePanel Control
        2. 24A.1.2. UpdateProgress Control
        3. 24A.1.3. Time Control
      2. 24A.2. TRY IT
        1. 24A.2.1. Lesson Requirements
        2. 24A.2.2. Hints
        3. 24A.2.3. Step-by-Step
    3. 24B. Using the Ajax Helpers in MVC
      1. 24B.1. TRY IT
        1. 24B.1.1. Lesson Requirements
        2. 24B.1.2. Hints
        3. 24B.1.3. Step-by-Step
    4. 25A. Using jQuery for Ajax in Web Forms
      1. 25A.1. AJAX METHODS
      2. 25A.2. AJAX EVENT HANDLERS
      3. 25A.3. TRY IT
        1. 25A.3.1. Lesson Requirements
        2. 25A.3.2. Hints
        3. 25A.3.3. Step-by-Step
    5. 25B. Using jQuery for Ajax in MVC
      1. 25B.1. AJAX METHODS
      2. 25B.2. AJAX EVENT HANDLERS
      3. 25B.3. TRY IT
        1. 25B.3.1. Lesson Requirements
        2. 25B.3.2. Hints
        3. 25B.3.3. Step-by-Step
  16. X. Securing Your Application
    1. 26. Authentication
      1. 26.1. AUTHENTICATION PROVIDERS
      2. 26.2. MEMBERSHIP
      3. 26.3. ROLES
      4. 26.4. ASP.NET WEB SITE ADMINISTRATION TOOL
      5. 26.5. TRY IT
        1. 26.5.1. Lesson Requirements
        2. 26.5.2. Hints
        3. 26.5.3. Step-by-Step
    2. 27A. Create a Login Page in Web Forms
      1. 27A.6. LOGIN CONTROL
      2. 27A.7. CHANGEPASSWORD CONTROL
      3. 27A.8. PASSWORDRECOVERY CONTROL
      4. 27A.9. CREATEUSERWIZARD CONTROL
      5. 27A.10. MORE LOGIN SERVER CONTROLS
      6. 27A.11. TRY IT
        1. 27A.11.1. Lesson Requirements
        2. 27A.11.2. Hints
        3. 27A.11.3. Step-by-Step
    3. 27B. Create a Login Page in MVC
      1. 27B.1. REGISTRATION PAGE
      2. 27B.2. LOG ON PAGE
      3. 27B.3. TRY IT
        1. 27B.3.1. Lesson Requirements
        2. 27B.3.2. Hints
        3. 27B.3.3. Step-by-Step
    4. 28A. Authorization in Web Forms
      1. 28A.1. AUTHORIZATION ELEMENT
      2. 28A.2. ASP.NET WEB SITE ADMINISTRATION TOOL
      3. 28A.3. TRY IT
        1. 28A.3.1. Lesson Requirements
        2. 28A.3.2. Hints
        3. 28A.3.3. Step-by-Step
    5. 28B. Authorization in MVC
      1. 28B.1. TRY IT
        1. 28B.1.1. Lesson Requirements
        2. 28B.1.2. Hints
        3. 28B.1.3. Step-by-Step
    6. A. Ajax Control Toolkit
      1. A.1. CALENDAR EXTENDER
        1. A.1.1. ASP.NET Web Forms Framework
        2. A.1.2. ASP.NET MVC Framework
      2. A.2. MORE EXTENDERS
        1. A.2.1. TextBoxWatermark Extender
        2. A.2.2. Other Extenders
      3. A.3. CONTROLS
    7. B. What's on the DVD?
      1. B.1. SYSTEM REQUIREMENTS
      2. B.2. USING THE DVD
      3. B.3. WHAT'S ON THE DVD
      4. B.4. TROUBLESHOOTING
      5. B.5. CUSTOMER CARE