Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover
Title
Copyright
Dedication
Contents at a Glance
Contents
About the Author
About the Technical Reviewer
Acknowledgments
Part I: Getting Started
Chapter 1: Introduction
Who Should Read This Book?
What Is Covered in This Book?
What Is the Structure of This Book?
What Do You Need to Read This Book?
Getting the Example Code
Finding More Information
The MSDN Library
Online Forums
Other Books
Summary
Chapter 2: Getting Ready
Installing Visual Studio 2010
Installing the Essential Software
Installing Optional Components
IIS Express
SQL Server 2008 R2 Management Studio Express
Getting Ready for the MVC Framework
Ninject
MVC Framework Source Code
Summary
Chapter 3: Putting ASP.NET in Context
An Overview of ASP.NET
The Structure of ASP.NET
The Core ASP.NET Platform
Web Forms
The MVC Framework
Understanding Related Technologies
Dynamic Data
Silverlight
HTML5
jQuery and ASP.NET Ajax
IIS and Windows Server
Summary
Part II: Getting to Know ASP .NET
Chapter 4: Working with Pages
Getting Started with Pages
Adding a Web Page
Creating an HTML File
Viewing the HTML File
Making a Page Dynamic with Code Blocks
Adding the Page Directive
Adding a Code Block
Viewing a Dynamic Web Page
Using a Code-Behind File
Preparing the Page File
Creating the Code-Behind Class
Editing the Code-Behind File
Understanding the Code-Behind Class
Working with HTML Controls
Using the Event Handler Method
Viewing a Page with a Code-Behind Class
Summary
Chapter 5: Working with Context and Events
Working with ASP.NET Events
Page Events
Application Events
Working with Context
The Request Context
The Response Context
The Server Context
Passing Information Between Pages
Passing Context Using the HttpContext Class
Summary
Chapter 6: Working with Forms and State
Working with Forms
Creating a Form
Completing the Form
Creating the Calculation Code
Creating the Code-Behind Class
Using the Form
Putting Forms in Context
Working with State
Using Form Input State
Using View State
Using Session State
Using Application State
Putting State in Context
Summary
Chapter 7: Handling Errors
Handling Errors
Creating the Handling Errors Example
Testing the Handling Errors Example
Handling Errors in Pages
Handling Errors with the Application
Configuring Custom Errors
Putting Error Handling in Context
Using ASP.NET Tracing
Creating the TraceDemo Example
Enabling Tracing
Performing a Trace
Adding Custom Trace Messages
Using the Trace Viewer
Putting ASP.NET Tracing in Context
Using the Visual Studio Debugger
Setting a Breakpoint
Selecting the Start Page
Running the Debugger
Summary
Chapter 8: Working with Data
Creating the Data Model
Viewing the Entity Data Model
Importing the Stored Procedures
Using the Data Model
Querying the Data Model
Using LINQ to Query the Data Model
Calling Stored Procedures
Consolidating the Data-Access Code
Performing Other Data Operations
Adding Data
Updating and Deleting Data
Implementing Page Support for Updating and Deleting Data
Managing Concurrency
Summary
Chapter 9: Styling Content
Creating the Project
Using ASP.NET Master Pages
Customizing Master Pages
Using a Master Page in a Web Page
Working with jQuery
Styling Content with jQuery
Using Other Common jQuery Styling Techniques
Summary
Chapter 10: Adding Interactivity
Creating the Project
Improving Client Interactions with jQuery
Responding to Events
Filtering Data at the Client
Replacing Links with Buttons
Improving Table Row Interactions
Validating Forms
Using jQuery UI
Installing jQuery UI
Creating a Better Button
Making Selecting Dates Easier
Adding Context with Tabs
Summary
Chapter 11: Working with Ajax
Getting Started with Ajax
Adding the Web Service
Testing the Web Service
Preparing the ASP.NET Web Page
Adding the Ajax Script
Testing the Ajax Functionality
Using Data Templates
Creating the Web Service
Testing the Web Service
Preparing the ASP.NET Web Page
Adding the Ajax Script
Testing the Ajax Functionality
Using Ajax to Post an HTML Form
Creating the Web Page
Adding Ajax Posting
Switching to JSON
Using Ajax to POST to a Web Service
Summary
Chapter 12: Working with Routes
Preparing the Project
Working with Routes
Creating an Alias for a URL
Understanding Route Ordering
Working with Route Variables
Supplying Default Values for Routing Variables
Applying Constraints to Routing Variables
Routing Patterns with Variable Segments
Disabling Nonrouted URLs
Using Routed URLs in Web Pages
Fixing the Master Page Tabs
Routing URLs to Web Services
Summary
Part III: Using Web Forms
Chapter 13: Putting Web Forms in Context
Understanding Web Forms
The Web Forms Design Philosophy
The Web Forms Architecture
Understanding Web Forms Strengths
Fast to Build, Simple to Use
Easy to Recruit Talent
Ignores the Low-Level Details
Actively Developed, Widely Supported
Understanding Web Forms Weaknesses
Poor Maintainability
Poor Unit Testability
Bandwidth-Heavy View State
Inflexibility
Low Developer Mindshare
Deciding When to Use Web Forms
Summary
Chapter 14: Working with the Web Forms Designer
Creating a Simple Web Forms Project
Using the Design Surface
Adding Controls to the Design Surface
Configuring UI Controls Using Properties
Using CSS with Web Forms UI Controls
Using the New Style Dialog
Using the CSS Properties Tool
Creating UI Control Event Handlers
Summary
Chapter 15: Working with Web Forms Controls
Getting to Know the Basic Web Forms Controls
Working with Controls Programmatically
Using List-Based Controls
Using Controls that Produce JavaScript
Understanding When Control Events Are Triggered
Understanding Bubble Events
Using the Navigation Controls
Using the Menu Control
Using the TreeView Control
Using Site Maps
Using Other Web Forms Controls
Using the Calendar Control
Using the PlaceHolder Control
Using the Wizard Control
Using the MultiView Control
Summary
Chapter 16: Customizing Web Forms Controls
Creating a User Control
Adding Events to User Controls
Adding Properties to User Controls
Using User Controls in Pages
Using Control Templates
Using Control Adapters
Creating a Control Adapter
Creating a Browser File
Creating Custom Controls
Adding Properties to a Custom Server Control
Rendering the Output of a Custom Server Control
Adding the Custom Control to the Toolbox
Summary
Chapter 17: Validating Form Data
Performing Manual Validation
Performing Automatic Validation
Understanding the Validation Controls
Requiring a Value
Accepting a Range of Values
Validating Against a Specific Value
Validating Using a Regular Expression
Styling and Positioning Validation Messages
Using Static and Dynamic Layout
Using a Validation Summary
Using Server-Side Validation
Creating a Custom Validation Function
Summary
Chapter 18: Using Web Forms Data Sources
A Quick Example of Using Data Source Controls
Creating the Data
Creating the Data Source
Creating the UI Control
Working with Data Sources
Using the Entity Framework Data Source
Using the SQL Data Source
Using the LINQ Data Source
Using LINQ Queries As Data Sources
Using Query Results As Data Sources
Using LINQ with XML
Summary
Chapter 19: Using Web Forms Data Binding
Data Binding with Basic Web Forms Controls
Using the Navigation Controls
Creating Data-Bound Templates
Creating Read-Only Templates
Using Data Item Containers
Creating Editor Templates
Using Paging
Using a Paging-Enabled Control
Using the PagedDataSource Control
Fixing the Data-Loading Problem
Summary
Chapter 20: Using the Rich Data Controls
Putting the Rich Data Controls in Context
Using the DetailsView Control
Using the FormView Control
Using the Repeater Control
Using the ListView Control
Paging with the ListView Control
Sorting Data with the ListView Control
Using the DataList Control
Using a Flow Layout
Selecting Data Items
Using the GridView Control
Controlling Data Sorting
Configuring the Command Buttons
Creating Charts
Summary
Chapter 21: The Web Forms Triathlon App
Creating the Project
Adding the Data Model
Adding Images and Styles
Adding the Master Page and Web Forms Pages
Checking the Project
Building the Master Page
Adding the Banner
Adding the Footer
Adding the Tabs
Building the Events Page
Adding the Event Table
Adding the Other UI Elements
Obtaining the Data and Configuring the Controls
Building the Event Editor Page
Adding the Code-Behind Class
Building the Performance Page
Building the Calculator Page
Summary
Part IV: Using the MVC Framework
Chapter 22: Putting MVC in Context
Understanding Model-View-Controller
Understanding the Model
Understanding the Controller
Understanding the View
Understanding the Model, Controller, and View Interaction
Understanding MVC Framework Strengths
Separation of Concerns
Easy Testing
Tight Control Over HTTP and HTML
Open Source
Highly Configurable
Built on ASP.NET
The Prettiest Girl at the Prom
Understanding MVC Framework Weaknesses
Lots of New Concepts to Learn
Projects Take Longer to Get Started
Discipline Is Required
Rapidly Changing Platform
Team Architecture Tension
Deciding When to Use the MVC Framework
Summary
Chapter 23: A First MVC Application
Creating the Project
Creating the Domain Model
Creating the Repository
Creating a Dummy Repository Implementation
Creating the Controller
Creating the View
Running the MVC Framework Application
Finishing the Basic Features
Using the Repositories
Handling the Form POST
Enhancing the Application
Using Model Binding
Adding Dependency Injection
Using a Dependency Injection Container
Summary
Chapter 24: Implementing a Persistent Repository
Creating the Database
Adding the Tables
Defining the Foreign Key Relationship
Inserting the Seed Data
Creating the Repository
Creating the Entity Framework Adapter
Creating the Repository Implementation
Defining the Connection String
Registering the Repository Class
Preparing the Model
Modifying the Controller and the Views
Summary
Chapter 25: Working with Views
Creating the Action Method
Understanding the Location Search
Creating the View
Understanding Razor
Working with the Model Object
Inserting Other Values
Using Razor Conditional Tags
Defining a Code Block
Creating an Inline HTML Helper
Working with Layouts
Defining the Title
Adding Content References
Inserting the View Contents
Defining a Different Layout
Using Partial Views
Other View Features
Razor Sections
Razor Comments
Using jQuery IntelliSense
Enabling Compile-Time Checking
Summary
Chapter 26: Using HTML Helpers and Templates
Creating an External Helper Method
Using the Built-in Helper Methods
Creating Forms
Using the Input Helper Methods
Using the Strongly Typed Input Helper Methods
Creating select Elements
Using the Templated Helper Methods
Customizing the Templated Helpers with Metadata
Creating Custom Templates
Using the Whole-Model Templated Helper Methods
Summary
Chapter 27: Using Routing and Areas
Understanding Routing in the MVC Framework
Using the MapRoute Method
Handling Routing Parameters in Action Methods
Constraining MVC Framework Routes
Generating Outgoing URLs
Targeting Other Controllers
Passing Values for Routing Variables
Specifying HTML Attributes
Generating Fully Qualified URLs in Links
Generating URLs (and Not Links)
Using Areas
Creating an Area
Populating an Area
Resolving the Ambiguous Controller Error
Generating Links to Actions in Areas
Summary
Chapter 28: Working with Action Methods
Preparing the Project
Understanding Results from Action Methods
Returning a String from an Action Method
Understanding Action Results
Passing Data from the Action Method to the View
Using a View Model Object
Using the ViewBag
Using ViewData
Using Child Actions
Creating a Child Action
Rendering a Child Action
Using the HTTP Method Selector Attributes
Dealing with Exceptions
Setting Global Error Handlers
Defining a Local Error Handler
Summary
Chapter 29: Working with Model Binding and Validation
Understanding Model Binding
Handling the Form Post Without Model Binding
Handling the Form Post with Basic Binding
Handling the Form Post with a Complex Type
Handling the Form Post with a Custom Model Binder
Validating Models
Setting Up Basic Model Validation
Using the Validation Helpers
Defining Validation Rules Using Metadata
Performing Additional Property-Level Validation
Performing Model-Level Validation
Using Client-Side Validation
Summary
Chapter 30: Using Unobtrusive Ajax
Preparing the Project
Enabling Unobtrusive Ajax
Using Unobtrusive Ajax Forms
Performing Graceful Degradation
Providing Feedback to the User During a Request
Working with Ajax Callbacks
Using Unobtrusive Ajax Links
Performing Graceful Degradation
Working with JSON
Processing JSON at the Client
Performing Remote Validation
Summary
Chapter 31: The MVC Framework Triathlon App
Creating the Project
Creating the Model
Creating and Implementing the Repository
Implementing the Repository
Defining the Connection String
Setting Up Dependency Injection
Configure the Routing
Creating the Event Controller
Building the Layout
Creating the CSS styles
Adding the Header and Footer
Adding the Tabs
Building the Events Tab
Defining the Views
Adding Some jQuery Polish
Building the Add Event Feature
Building the Edit Feature
Fixing the Repository
Building the Delete Feature
Building the Performance Tab
Building the Calculator Tab
Summary
Part V: Wrapping Up
Chapter 32: Preparing a Server for Deployment
Enabling the Web Server Role
Installing Additional Components
Setting Up Web Deployment
Understanding the IIS Fundamentals
Understanding Web Sites
Understanding Virtual Directories
Understanding Application Pools
Binding Web Sites to Hostnames, IP Addresses, and Ports
Preparing the Server for the Application
Summary
Chapter 33: Deploying an ASP .NET Application
Preparing for Deployment
Enabling Dynamic Page Compilation
Preparing the Web.config File for Transformation
Preparing the Project for Database Deployment
Preparing for a Bin Deployment (MVC Framework Only)
Deploying an Application
Deploying an Application by Copying Files
Using a Deployment Package
Using One-Click Publishing
Summary
Chapter 34: Authentication and Authorization
Setting Up Authentication
Using Windows Authentication
Using Forms Authentication
Performing Authentication and Authorization
Using an MVC Framework Application
Using a Web Forms Application
Using Membership, Roles, and Profiles
Setting Up and Using Membership
Setting Up and Using Roles
Setting Up and Using Profiles
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →