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 Creating a Basic Form Using Strongly Typed HTML Helpers

John Fouts
John Fouts
12,234 Points

Need help - keep getting error message stating that I need to use strongly typed version @Html.LabelFor call but I am...

Please see my code from the question (It is my understanding that it will be attached to this question - if I need to do something differently to attach it please let me know). I am driving myself nuts trying to figure out what I am doing wrong. I don't understand where I am missing something or where I need something syntax-wise. Could you please take a look at my code and give me a clue?

Report.cshtml
@model IssueReporter.Models.Issue

@{
    ViewBag.Title = "Report an Issue";
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    <div>
        @Html.LabelFor(model => model.Name)
        @Html.TextBoxFor(model => model.Name)
    </div>

    <div>
        @Html.Label("Email")
        @Html.TextBox("Email")
    </div>

    <div>
        @Html.Label("DepartmentId")
        @Html.TextBox("DepartmentId")
    </div>

    <div>
        @Html.Label("Severity")
        @Html.TextBox("Severity")
    </div>

    <div>
        @Html.Label("Reproducible")
        @Html.TextBox("Reproducible")
    </div>

    <div>
        @Html.Label("DescriptionOfProblem")
        @Html.TextArea("DescriptionOfProblem")
    </div>

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

2 Answers

Steven Parker
Steven Parker
216,148 Points

It appears you have found a bug! :beetle:

The challenge seems to only want "m" used as the lambda expression argument name. If you change "model" to "m" you should pass the challenge.

You might want to report this bug to Support. You may even get the "special Exterminator badge".

James Churchill
STAFF
James Churchill
Treehouse Teacher

John,

Thanks for reporting this bug with the code challenge. It's been updated to allow you to use any argument name in your lambda expression.

Thanks ~James

Steven Parker
Steven Parker
216,148 Points

Does he get the "Exterminator" for that?