Understanding Razor

In the following sections, I'll show you the different types of Razor tag, and along the way, we'll add some new functionality to our view. As you read these sections, remember where the view sits in the MVC model. The MVC framework has passed a request to an action method in a controller, and the controller has done whatever it needs to the model and has called the View method to tell the MVC framework to render a view. The view will be used to generate an HTML page that will be returned to the user's browser.

To maintain our separation of concerns, we want to focus on creating a template that renders the HTML we require. We don't want to do any heavy computation (that's the job of the controller), and we don't want to hold ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.