ASP.NET MVC 2 cookbook over 70 clear and incredibly effective recipes to get the most out of the many tools and features of the ASP.NET MVC framework. - "Quick answers to common problems"--Cover. - Includes index
معرفی کتاب «ASP.NET MVC 2 cookbook over 70 clear and incredibly effective recipes to get the most out of the many tools and features of the ASP.NET MVC framework. - "Quick answers to common problems"--Cover. - Includes index» نوشتهٔ Andrew Siemer [and] Richard Kimber، منتشرشده توسط نشر Packt Publishing Limited در سال 2011. این کتاب در 404 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است.
In Detail ASP.NET MVC, one of the latest web development platforms from Microsoft, brings the power of MVC programming to ASP.NET development. It simplifies the task of application development and maintenance for developers. However, ASP.NET MVC is filled with so many features that developers end up looking for solutions to the many problems that are encountered in their routine development tasks.ASP.NET MVC 2 Cookbook will provide solutions for the very specific problems that are encountered while developing applications with the ASP.NET MVC platform. It consists of many recipes containing step-by-step instructions that guide developers to effectively use the wide array of tools and features of ASP.NET MVC platform for web development ASP.NET MVC Cookbook is a collection of recipes that will help you to perform your routine development tasks with ease using the ASP.NET MVC platform. In this book you will be walked through the solution to several specific web application development problems. Each recipe will walk you through the creation of a web application, setting up any Visual Studio project requirements, adding in any external tools, and finally the programming steps needed to solve the problem. The focus of the book is to describe the solution from start to finish. The book starts off with recipes that demonstrate how to work effectively with views and controllers two of the most important ingredients of the ASP.NET MVC framework. It then gradually moves on to cover many advanced routing techniques. Considering the importance of having a consistent structure to the site, the book contains recipes to show how to build a consistent UI and control its look with master pages. It also contains a chapter that is packed with many recipes that demonstrate how to gain control of data within a view. As the book progresses through some exciting recipes on performing complex tasks with forms, you will discover how easy it is to work with forms to jazz up the look of your web site. Building large applications with ease is one of the prime features of the MVC model. Therefore, this book also focuses on tools and features that make building large applications easier to manage. As data plays an important role in the MVC architecture, there are ample recipes dedicated to cover data validation, access, and storage techniques. Finally, the book demonstrates how to enhance the user experience of your visitors by controlling the data at the application, session, caching, and cookie level. By the end of this book, you will have explored a wide array of tools and features available with the ASP.NET MVC platform A fast-paced cookbook with recipes covering all that you wanted to know about developing with ASP.NET MVC Approach Written in cookbook style, this book offers solutions to all common web development problems through recipes. Each recipe contains step-by-step instructions followed by the analysis of what was done in each task and other useful information. The book is designed so that you can read it chapter by chapter, or you can look at the list of recipes and refer to them in no particular order. Who this book is for This book is particularly written for web developers looking to transfer their knowledge from the ASP.NET Web Forms way of doing things to the ASP.NET MVC framework. As this book targets readers of various experience levels, you should be able to find recipes of a basic, intermediate, and advanced nature. Regardless of your experience level, each recipe will walk you through the solution in a step by step manner that anyone should be able to follow. Cover......Page 1 Copyright......Page 3 Credits......Page 4 About the Authors......Page 5 About the Reviewers......Page 6 www.PacktPub.com......Page 8 Table of Contents......Page 10 Preface......Page 14 Introduction......Page 20 Using magic strings and the ViewData dictionary......Page 21 Creating a strongly typed view......Page 26 Decoupling a strongly typed view with a View model......Page 29 Centralizing display logic with templated helpers......Page 33 Using a partial view to segment view code......Page 35 Rendering a child view with Html.RenderAction......Page 43 Loading a view template from a database with NVelocity......Page 48 Consuming a JSON with jQuery......Page 53 Introduction......Page 58 Exposing JSON using a JsonResult with Json.NET......Page 59 A custom ActionResult to return an image......Page 61 Specifying the size of an ImageResult......Page 65 Creating a CAPTCHA system......Page 71 Generating a PDF order summary......Page 76 Implementing a controller factory for use with StructureMap......Page 79 Introduction......Page 86 Creating a route to support a reporting engine......Page 87 Making hackable URLs for a product catalog......Page 89 Filter your matches with routing constraints......Page 93 Using wildcard parameters to support slug URLs......Page 95 Creating a 404 page via routing......Page 96 Moving routes out of Global.asax......Page 100 Supporting pagination in your URLs......Page 102 Supporting content hierarchies with a custom RouteHandler......Page 108 Creating a blacklist route constraint......Page 112 How to create a master page......Page 118 Determining the master page in the ActionResult......Page 122 Controlling which master page is used with a view base class......Page 123 Setting the master page from a controller base class......Page 124 Passing data to the master page......Page 126 Rendering data in a master page from another view......Page 128 Creating nested master pages......Page 130 Introduction......Page 132 Reintroducing for and foreach......Page 133 Handling an array of checkboxes......Page 139 Handling an array of radio buttons......Page 141 Working with a pageable set of data......Page 143 How to navigate sortable data......Page 145 Deleting a record with an intermediary "Are you sure?" page......Page 150 Adding a jQuery delete link with confirmation......Page 153 Master/detail page with inline details via jQuery and a partial view......Page 157 Creating a master/detail page with modal pop-up and JSON......Page 161 Introduction......Page 166 Using HTML helpers to create forms......Page 167 Building a custom HTML helper to display a WYSIWYG......Page 170 Centralizing create and edit forms for reuse......Page 176 Adding custom attributes to form elements......Page 179 Defining a default button with jQuery......Page 180 Hijaxing a form with jQuery......Page 183 Performing an auto post-back with a select list......Page 188 Autocomplete with jQuery UI......Page 191 Introduction......Page 196 Centralized formatting of common types with templated helpers......Page 197 Making templated helpers for custom types......Page 200 Using areas to separate application components......Page 204 Creating a "portable area" to use across multiple applications......Page 205 Using input builders of MvcContrib......Page 211 Generating forms with Html.InputForm()......Page 215 Leaving breadcrumbs for your users with MvcSiteMap......Page 217 Displaying tabular data in a grid......Page 220 Basic input validation......Page 224 Data annotations......Page 229 Client-side validation with jQuery......Page 231 Custom validators......Page 233 Remote validation with jQuery......Page 236 Introduction......Page 244 Mocking your data layer with NBuilder......Page 245 Adding support for LINQ to SQL......Page 257 Going old school with ADO.NET......Page 270 XML documents as a data store......Page 276 Introduction......Page 286 Keeping track of anonymous visitors versus logged-in users......Page 287 Maintaining a user's information while at your site......Page 292 Remembering a previous visitor......Page 295 Caching your product catalog for faster response times......Page 300 Using output caching to cache an entire page......Page 305 Using partial views to cache pieces of a page individually......Page 309 Exposing an application API to your presentation layer......Page 318 Index......Page 324 Cover 1 Copyright 3 Credits 4 About the Authors 5 About the Reviewers 6 www.PacktPub.com 8 Table of Contents 10 Preface 14 Chapter 1: Working with the View 20 Introduction 20 Using magic strings and the ViewData dictionary 21 Creating a strongly typed view 26 Decoupling a strongly typed view with a View model 29 Centralizing display logic with templated helpers 33 Using a partial view to segment view code 35 Rendering a child view with Html.RenderAction 43 Loading a view template from a database with NVelocity 48 Consuming a JSON with jQuery 53 Chapter 2: Taking Action in Your Controllers 58 Introduction 58 Exposing JSON using a JsonResult with Json.NET 59 A custom ActionResult to return an image 61 Specifying the size of an ImageResult 65 Creating a CAPTCHA system 71 Generating a PDF order summary 76 Implementing a controller factory for use with StructureMap 79 Chapter 3: Routing 86 Introduction 86 Creating a route to support a reporting engine 87 Making hackable URLs for a product catalog 89 Filter your matches with routing constraints 93 Using wildcard parameters to support slug URLs 95 Creating a 404 page via routing 96 Moving routes out of Global.asax 100 Supporting pagination in your URLs 102 Supporting content hierarchies with a custom RouteHandler 108 Creating a blacklist route constraint 112 Chapter 4: Master Pages 118 Introduction 118 How to create a master page 118 Determining the master page in the ActionResult 122 Controlling which master page is used with a view base class 123 Setting the master page from a controller base class 124 Passing data to the master page 126 Rendering data in a master page from another view 128 Creating nested master pages 130 Chapter 5: Working with Data in the View 132 Introduction 132 Reintroducing for and foreach 133 Handling an array of checkboxes 139 Handling an array of radio buttons 141 Working with a pageable set of data 143 How to navigate sortable data 145 Deleting a record with an intermediary "Are you sure?" page 150 Adding a jQuery delete link with confirmation 153 Master/detail page with inline details via jQuery and a partial view 157 Creating a master/detail page with modal pop-up and JSON 161 Chapter 6: Working with Forms 166 Introduction 166 Using HTML helpers to create forms 167 Building a custom HTML helper to display a WYSIWYG 170 Centralizing create and edit forms for reuse 176 Adding custom attributes to form elements 179 Defining a default button with jQuery 180 Hijaxing a form with jQuery 183 Performing an auto post-back with a select list 188 Autocomplete with jQuery UI 191 Chapter 7: Simplifying Complex Applications 196 Introduction 196 Centralized formatting of common types with templated helpers 197 Making templated helpers for custom types 200 Using areas to separate application components 204 Creating a "portable area" to use across multiple applications 205 Using input builders of MvcContrib 211 Generating forms with Html.InputForm() 215 Leaving breadcrumbs for your users with MvcSiteMap 217 Displaying tabular data in a grid 220 Chapter 8: Validating MVC 224 Introduction 224 Basic input validation 224 Data annotations 229 Client-side validation with jQuery 231 Custom validators 233 Remote validation with jQuery 236 Chapter 9: Data Access and Storage 244 Introduction 244 Mocking your data layer with NBuilder 245 Adding support for LINQ to SQL 257 Going old school with ADO.NET 270 XML documents as a data store 276 Chapter 10: Application, Session, Cookies, and Caching 286 Introduction 286 Keeping track of anonymous visitors versus logged-in users 287 Maintaining a user's information while at your site 292 Remembering a previous visitor 295 Caching your product catalog for faster response times 300 Using output caching to cache an entire page 305 Using partial views to cache pieces of a page individually 309 Exposing an application API to your presentation layer 318 Index 324 Annotation ASP.NET MVC, one of the latest web development platforms from Microsoft, brings the power of MVC programming to ASP.NET development. It simplifies the task of application development and maintenance for developers. However, ASP.NET MVC is filled with so many features that developers end up looking for solutions to the many problems that are encountered in their routine development tasks. ASP.NET MVC 2 Cookbook will provide solutions for the very specific problems that are encountered while developing applications with the ASP.NET MVC platform. It consists of many recipes containing step-by-step instructions that guide developers to effectively use the wide array of tools and features of ASP.NET MVC platform for web development ASP.NET MVC Cookbook is a collection of recipes that will help you to perform your routine development tasks with ease using the ASP.NET MVC platform. In this book you will be walked through the solution to several specific web application development problems. Each recipe will walk you through the creation of a web application, setting up any Visual Studio project requirements, adding in any external tools, and finally the programming steps needed to solve the problem. The focus of the book is to describe the solution from start to finish. The book starts off with recipes that demonstrate how to work effectively with views and controllers _ two of the most important ingredients of the ASP.NET MVC framework. It then gradually moves on to cover many advanced routing techniques. Considering the importance of having a consistent structure to the site, the book contains recipes to show how to build a consistent UI and control its look with master pages. It also contains a chapter that is packed with many recipes that demonstrate how to gain control of data within a view. As the book progresses through some exciting recipes on performing complex tasks with forms, you will discover how easy it is to work with forms to jazz up the look of your web site. Building large applications with ease is one of the prime features of the MVC model. Therefore, this book also focuses on tools and features that make building large applications easier to manage. As data plays an important role in the MVC architecture, there are ample recipes dedicated to cover data validation, access, and storage techniques. Finally, the book demonstrates how to enhance the user experience of your visitors by controlling the data at the application, session, caching, and cookie level. By the end of this book, you will have explored a wide array of tools and features available with the ASP.NET MVC platform A fast-paced cookbook with recipes covering all that you wanted to know about developing with ASP.NET MVC Over 70 clear and incredibly effective recipes to get the most out of the many tools and features of the ASP.NET MVC framework
دانلود کتاب ASP.NET MVC 2 cookbook over 70 clear and incredibly effective recipes to get the most out of the many tools and features of the ASP.NET MVC framework. - "Quick answers to common problems"--Cover. - Includes index