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
We’ve just been defining our data directly in the view. Typically, it’s the controller’s job to supply data to the view. Let’s move our data from our view to the controller.
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.4 -b setting-data-in-the-controller
Additional Learning
For more information on using dynamic types in C#, see this MSDN page.
Keyboard Shortcuts
-
CTRL+C
- Copy to clipboard -
CTRL+X
- Cut to clipboard -
CTRL+V
- Paste from clipboard
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
PLUS
kevin hudson
Courses Plus Student 11,987 Points0 Answers
-
PLUS
Chris Troy
Courses Plus Student 7,395 Points1 Answer
-
Jolanda -
885 Points2 Answers
-
Jake Ford
9,230 Points1 Answer
-
Sudheesh Kumar Reddy Ojili
821 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