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

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
231,248 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".

Thank you Steven.

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
231,248 Points

Does he get the "Exterminator" for that?