Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

@Model not does not exist in the current context

My Visual Studio is saying that the @Model reference does not exist in my Detail.cshtml file.

I include the @model ComicBookGallery.Models.ComicBook directive.

@model ComicBookGallery.Models.ComicBook

@{ Layout = "~/Views/Shared/_Layout.cshtml"; ViewBag.Title = "ComicBook Detail"; }

<!DOCTYPE html>

<html> <head> <meta name="viewport" content="width=device-width" /> <title></title> </head> <body> <div> <h1>@Model.</h1> <h2>Issue #@Model.IssueNumber</h2>

    <h5>Description:</h5>
    <div>@Html.Raw(@Model.Description)</div>

    @if (@Model.Artists.Length > 0)
    {
        <h5>Artists:</h5>
        <div>
            <ul>
                @foreach (var artist in @Model.Artists)
                {
                    <li>@artist</li>
                }
            </ul>
        </div>
    }
</div>

</body> </html>