O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using partial views to cache pieces of a page individually

In this recipe, we will take a look at how we can use the RenderAction method to get a partial view. We will do this by creating a shared partial view that is capable of rendering any action in which we might be interested. We will then create an extension method, which is capable of calling our helper view and converting that into a string. This string can then be cached. Best of all, this particular approach allows us to use the appropriate controller to take care of the requirements for each of the views being rendered.

How to do it...

  1. Start by creating a new default ASP.NET MVC 2 application.
  2. Then add a reference to NBuilder, so that we can generate a huge list of data. This huge list ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required