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

C# ASP.NET MVC Basics Adding a List Page Creating a List View

olu adesina
olu adesina
23,007 Points

im sure i have got this question right

its keeps asking me if i have removed any mark up? which i haven't help please !!!

Index.cshtml
@model Treehouse.Models.VideoGame[]

@{
    ViewBag.PageTitle = "Video Games";  
}

<h1>@ViewBag.PageTitle</h1>
<div>

  @foreach (var videoGame in videogames)
  {
    <ul>
      <li> @VideoGame.DisplayText </li>
    </ul>
  }
</div>

1 Answer

Don' t put the ul-tags inside the foreach loop, this would create a new unordered list foreach item in the model. And also be sure to declare the videoGames variable or just use the 'Model' variable like this:

@foreach(var videoGame in Model)
{...}

If this still does not work try removing the spaces in the list elements

I forgot to remind you, that you must use the videoGame variable inside of the list item;