This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Adding a View 4:03
- Adding a View Review 5 questions
- Using Razor for View Layout 5:30
- Using the Razor Syntax 1 objective
- Displaying a List with Razor 4:16
- Displaying a List of Values 1 objective
- Setting Data in the Controller 5:51
- Using ViewBag 2 objectives
- Adding Design Files 4:41
- View Layouts 5:42
- Section Review 5 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
In the previous video we resolved the issue with the description in our view, but the array of artists is still not rendering properly. Let’s see how to use Razor to display a list of values.
Follow Along
To follow along commiting your changes to this course, you'll need to fork the aspnet-comic-book-gallery repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd aspnet-comic-book-gallery
git checkout tags/v3.3 -b displaying-a-list-with-razor
Additional Learning
Here’s an introduction to the Razor syntax on the official ASP.NET website.
Here’s a great blog post from Phil Haack containing a Razor syntax quick reference. Very handy!
Keyboard Shortcuts
-
CTRL+K+C
- Comment selection -
CTRL+K+U
- Uncomment selection
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
samuel both
3,636 Points1 Answer
-
Joel Brennan
18,300 PointsIs there any difference between testing if(artists.Length > 0) and if(artists.Any()) ? If so what is the difference?
Posted by Joel BrennanJoel Brennan
18,300 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up