Chapter 17. Advanced view techniques


This chapter covers
  • Using layouts to craft site-wide templates
  • Applying partials for shared snippets of content
  • Leveraging child actions for common widgets
  • Eliminating subtle URL-generation
  • Examining alternative view engines with the Spark view engine


The MVC pattern gives us separation of concerns between the model, controller, and view, but this pattern didn’t eliminate the need for developers to carefully design their views. You saw in the last chapter how you can use controller extension points to build clean, easy-to-modify controllers. With the elimination of code-behind and the addition of a view model object, you can focus strictly on rendering content inside your view. But without careful ...

Get ASP.NET MVC 4 in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.