C# ASP.NET MVC Forms Creating a Basic Form Using Strongly Typed HTML Helpers

Strongly typed views: Did you include the model directive?

Not sure what I'm doing wrong. I just added the @model IssueReporter.Models.Issue at the very top and didn't change anything else.

Report.cshtml
@model IssueReporter.Models.Issue
@{
    ViewBag.Title = "Report an Issue";
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    <div>
        @Html.Label("Name")
        @Html.TextBox("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>
}

1 Answer

Update: Restarted the task and added the @model directive. This time it worked.