Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# ASP.NET MVC Forms Improving Our Form Drop Down Lists

I tried to use the method in the video but so far no luck.

I tried to draw a parallel between the lesson taught in the video and the challenge, however the challenge is different enough that it confused me. I'm not sure where to begin

Report.cshtml
@model IssueReporter.Models.Issue

@{
    ViewBag.Title = "Report an Issue";
    ViewBag.Title = "Add Entry";
    var selectListItems = new [ ]
{
  new SelectListItem ( ) { Value = “1”, Text = “Item 1”, Selected = false },
  new SelectListItem ( ) { Value = “2”, Text = “Item 2”, Selected = true },
};
}
    <select> 
     <option value=“1”>Item 1 </option>
    <option value=“2” selected > Item 2 </option>
    </select>

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    <div>
        @Html.LabelFor(m => m.Name)
        @Html.DropDownListFor(m => m.DepartmentId)
      (SelectList)ViewBag.DepartmentsSelectListItems)
    </div>

    <div>
        @Html.LabelFor(m => m.Email)
        @Html.TextBoxFor(m => m.Email)
    </div>

    <div>
        @Html.LabelFor(m => m.DepartmentId)
        @Html.TextBoxFor(m => m.DepartmentId)
    </div>

    <div>
        @Html.LabelFor(m => m.Severity)
        @Html.DropDownListFor(m => m.Severity)
    </div>

    <div>
        @Html.LabelFor(m => m.Reproducible)
        @Html.TextBoxFor(m => m.Reproducible)
    </div>

    <div>
        @Html.LabelFor(m => m.DescriptionOfProblem)
        @Html.TextAreaFor(m => m.DescriptionOfProblem)
    </div>

    <button type="submit">Save</button>
}

2 Answers

Steven Parker
Steven Parker
218,653 Points

Just as in your previous question, it looks like you understood what to do.

But this time you forgot to change the original close parenthesis into a comma when you added the 2nd argument.

Got it. Thanks!