title: Reuse view template in different controllers in MVC.NET
body: <p>I have a <strong>Book controller</strong>, and an <strong>Author controller</strong>, inside Author, there is a request to get all books, now I already have a <code>Display Template</code> for the book sitting inside the Book controller, and would like to reuse it.... In cshtml, it's sort of easy:</p>
  
  <pre><code>@Html.Action("GetAuthorBooksBookBadge", "Book")
  </code></pre>
  
  <p>but if I want to call an Ajax function to return a list of books in string (Json) format, then I have to apply that action inside the controller code like this:</p>
  
  <pre><code>...
  ArrayList books = new ArrayList();
  
  // get books and add to the array in string format
  
  for (int i = 0; i &lt; 4; i++)
  {
      books.Add(Utils.RenderRazorViewToString(ControllerContext, "DisplayTemplates/DisplayBookBadge", book)); // TODO: fix
  }
  ...
  </code></pre>
  
  <p>Now as you can see, the <strong>ControllerContext</strong> does not belong in the right place.... I want to apply the Display Template inside the book controller, and return it as a string, how? I tried many ways where you create a controllercontext on the fly, create an instance of BookController... </p>