Chapter 6ASP.NET MVC Helpers and Extensions

What you will learn in this chapter:

  • How to display dynamic information
  • What Razor syntax is and how you use it in the view
  • How routing works
  • Creating actions on the controller
  • Getting your controllers and views to work together

Code Downloads for this Chapter:

The code downloads for this chapter are found at on the Download Code tab. The code is in the chapter 06 download and individually named according to the names throughout the chapter.

You have learned about how ASP.NET Web Forms take one type of approach, server controls, to do work whose outcome is rendered into HTML for consumption by the browser on the client machine. For example, a developer can add a server control to the markup and know that a textbox will be displayed in the browser. However, the complete structure of the HTML that is output is not within the developers' control unless they are using HTML controls, with their ancillary limited functionality.

The process is different in ASP.NET MVC. There is no such thing as a server control in the MVC world. There is, instead, a way of writing code “in the UI” that enables the developer to have complete control over the output that is sent to the client. As you can guess, however, “more control” means that you may have to do more writing of code. In some cases you may have scaffolding, or automatically created code (much like the project you started with), that ...

Get Beginning ASP.NET for Visual Studio 2015 now with O’Reilly online learning.

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