© Adam Freeman 2020
A. FreemanPro ASP.NET Core 3https://doi.org/10.1007/978-1-4842-5440-0_22

22. Using Controllers with Views, Part II

Adam Freeman1  
(1)
London, UK
 
In this chapter, I describe more of the features provided by Razor views. I show you how to pass additional data to a view using the view bang and how to use layouts and layout sections to reduce duplication. I also explain how the results from expressions are encoded and how to disable the encoding process. Table 22-1 summarizes the chapter.
Table 22-1.

Chapter Summary

Problem

Solution

Listing

Providing unstructured data to a view

Use the view bag

5, 6

Providing temporary data to a view

Use temp data

7, 8

Using the same content in multiple views

Use a layout

9–12, 15–18

Selecting the default layout ...

Get Pro ASP.NET Core 3: Develop Cloud-Ready Web Applications Using MVC, Blazor, and Razor Pages 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.