Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Let’s see how we can use the Razor syntax to improve our view layout.
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.2 -b using-razor-for-view-layout
Code
Here’s the comic book description and artist information.
<p>Final issue! Witness the final hours of Doctor Octopus' life and his one, last, great act of revenge! Even if Spider-Man survives... <strong>will Peter Parker?</strong></p>
"Script: Dan Slott",
"Pencils: Humberto Ramos",
"Inks: Victor Olazaba",
"Colors: Edgar Delgado",
"Letters: Chris Eliopoulos"
Here’s the C# code for the comic book variables.
var seriesTitle = "The Amazing Spider-Man";
var issueNumber = 700;
var description = "<p>Final issue! Witness the final hours of Doctor Octopus' life and his one, last, great act of revenge! Even if Spider-Man survives... <strong>will Peter Parker?</strong></p>";
var artists = new string[]
{
"Script: Dan Slott",
"Pencils: Humberto Ramos",
"Inks: Victor Olazaba",
"Colors: Edgar Delgado",
"Letters: Chris Eliopoulos"
};
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!
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated 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