Showing posts with label razor. Show all posts
Showing posts with label razor. Show all posts

Thursday, November 22, 2012

Brief introduction to MVC 3 partial views

Here's a brief and to the point introduction to MVC 3 partial views by Microsoft's Rachel Appel:

http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/

The introduction covers in less than 10 minutes the following topics:

  • What is a partial view and when should I use it?
  • Rendering partial views
  • Creating a partial view
  • Sharing Data between views and partial views

Wednesday, November 21, 2012

HOW TO: embed MVC 3 Razor code inside a javascript block

This one is actually a kind of weird trick that's is required (as far as I know) in the current version of MVC for embedding razor code inside a javascript block. It's very possible that you find yourself wondering how to accomplish this when you are begining with MVC and razor:

http://stackoverflow.com/questions/4204669/asp-net-mvc3-rc-razor-views-syntax-for-embedding-code-inside-javascript-bloc

P.S. I'm not sure if this is still necessary in the current version of MVC (MVC 4 ath the time of this writing)...