售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
ASP.NET MVC 2 Cookbook
Table of Contents
ASP.NET MVC 2 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Working with the View
Introduction
Using magic strings and the ViewData dictionary
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a strongly typed view
Getting ready
How to do it...
How it works...
There's more...
See also
Decoupling a strongly typed view with a View model
Getting ready
How to do it...
How it works...
There's more...
Centralizing display logic with templated helpers
Getting ready
How to do it...
How it works...
There's more...
Type-specific templated helpers
Where to put the DisplayTemplates folder?
DataAnnotations on your model to specify UIHints
Using a partial view to segment view code
How to do it...
How it works...
Rendering a child view with Html.RenderAction
How to do it...
How it works...
There's more...
Loading a view template from a database with NVelocity
Getting ready
How to do it...
How it works...
There's more...
Replacing the default MVC view engine with NVelocity
Want to load templates in other ways?
Want to use more than one view engine?
Consuming a JSON with jQuery
Getting ready
How to do it...
How it works...
There's more...
See Also
2. Taking Action in Your Controllers
Introduction
Exposing JSON using a JsonResult with Json.NET
Getting ready
How to do it...
How it works...
There's more...
See also
A custom ActionResult to return an image
Getting ready
How to do it...
How it works...
There's more...
Specifying the size of an ImageResult
Getting ready
How to do it...
How it works...
There's more...
Creating a CAPTCHA system
Getting ready
How to do it...
How it works...
There's more...
Hatches and colors
What is CAPTCHA?
Other styles of CAPTCHA
Generating a PDF order summary
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing a controller factory for use with StructureMap
Getting ready
How to do it...
How it works...
3. Routing
Introduction
Creating a route to support a reporting engine
How to do it...
How it works...
Making hackable URLs for a product catalog
Getting ready
How to do it...
How it works...
There's more...
Filter your matches with routing constraints
Getting ready
How to do it...
How it works...
Using wildcard parameters to support slug URLs
How to do it...
How it works...
Creating a 404 page via routing
How to do it...
How it works...
There's more...
Moving routes out of Global.asax
How to do it...
How it works...
There's more...
Supporting pagination in your URLs
How to do it...
How it works...
Supporting content hierarchies with a custom RouteHandler
How to do it...
How it works...
There's more...
Creating a blacklist route constraint
How to do it...
How it works...
4. Master Pages
Introduction
How to create a master page
How to do it...
How it works...
Determining the master page in the ActionResult
How to do it...
How it works...
Controlling which master page is used with a view base class
How to do it...
How it works...
Setting the master page from a controller base class
How to do it...
How it works...
Passing data to the master page
How to do it...
How it works...
Rendering data in a master page from another view
How to do it...
How it works...
Creating nested master pages
How to do it...
How it works...
5. Working with Data in the View
Introduction
Reintroducing for and foreach
How to do it...
Initial bits...
foreach over ViewData collection
foreach over strongly typed view model
for over strongly typed view model
How it works...
There's more...
Handling an array of checkboxes
Getting ready
How to do it...
How it works...
There's more...
See also
Handling an array of radio buttons
Getting ready
How to do it...
How it works...
See also
Working with a pageable set of data
Getting ready
How to do it...
How it works...
How to navigate sortable data
Getting ready
How to do it...
How it works...
There's more...
Deleting a record with an intermediary "Are you sure?" page
Getting ready
How to do it...
How it works...
Adding a jQuery delete link with confirmation
Getting ready
How to do it...
How it works...
There's more...
Master/detail page with inline details via jQuery and a partial view
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a master/detail page with modal pop-up and JSON
Getting ready
How to do it...
How it works...
See also
6. Working with Forms
Introduction
Using HTML helpers to create forms
How to do it...
How it works...
Building a custom HTML helper to display a WYSIWYG
Getting started
How to do it...
How it works...
There's more...
Centralizing create and edit forms for reuse
How to do it...
How it works...
Adding custom attributes to form elements
How to do it...
How it works...
Defining a default button with jQuery
How to do it...
How it works...
Hijaxing a form with jQuery
Getting started
How to do it...
How it works...
Performing an auto post-back with a select list
How to do it...
How it works...
Autocomplete with jQuery UI
Getting ready
How to do it...
How it works...
There's more...
7. Simplifying Complex Applications
Introduction
Centralized formatting of common types with templated helpers
Getting ready
How to do it...
How it works...
Making templated helpers for custom types
How to do it...
How it works...
There's more...
Using areas to separate application components
How to do it...
How it works...
There's more...
Creating a "portable area" to use across multiple applications
How to do it...
How it works...
There's more...
Using input builders of MvcContrib
How to do it...
How it works...
Generating forms with Html.InputForm()
How to do it...
How it works...
There's more...
Leaving breadcrumbs for your users with MvcSiteMap
Getting ready
How to do it...
How it works...
There's more...
Displaying tabular data in a grid
How to do it...
How it works...
8. Validating MVC
Introduction
Basic input validation
How to do it...
How it works...
Data annotations
How to do it...
How it works...
Client-side validation with jQuery
Getting ready
How to do it...
How it works...
Custom validators
How to do it...
How it works...
Remote validation with jQuery
Getting ready
How to do it...
How it works...
9. Data Access and Storage
Introduction
Mocking your data layer with NBuilder
Getting ready
How to do it...
How it works...
There's more...
Adding support for LINQ to SQL
Getting ready
How to do it...
How it works...
Going old school with ADO.NET
Getting ready
How to do it...
How it works...
XML documents as a data store
Getting ready
How to do it...
How it works...
10. Application, Session, Cookies, and Caching
Introduction
Keeping track of anonymous visitors versus logged-in users
How to do it...
How it works...
Maintaining a user's information while at your site
How to do it...
How it works...
Remembering a previous visitor
How to do it...
How it works...
Caching your product catalog for faster response times
How to do it...
How it works...
Using output caching to cache an entire page
How to do it...
How it works...
There's more...
Using partial views to cache pieces of a page individually
How to do it...
How it works...
Exposing an application API to your presentation layer
How to do it...
How it works...
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜