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 trialMaggie Nasho
6,212 PointsUsing HTML Helpers
Challenge Task 2 of 3
In Report.cshtml render the <label> element for the "Name" field using the Html.Label method. The label isnβt using any CSS classes, so you can use the first method overload that accepts a single string parameter for the expression to identify the property to display (MvcHtmlString HtmlHelper.Label(string expression)).
@{
ViewBag.Title = "Report an Issue";
}
<h2>@ViewBag.Title</h2>
@using(Html.BeginForm())
{
<div>
@Html.Label("Name")
<input type="text" id="Name" name="Name" />
</div>
<div>
@Html.Label("Email")
<input type="text" id="Email" name="Email" />
</div>
<div>
@Html.Label("DepartmentId")
<input type="text" id="DepartmentId" name="DepartmentId" />
</div>
<div>
@Html.Label("Severity")
<input type="text" id="Severity" name="Severity" />
</div>
<div>
@Html.Label("Reproducible")
<input type="text" id="Reproducible" name="Reproducible" />
</div>
<div>
@Html.Label("DescriptionOfProblem")
<textarea id="DescriptionOfProblem" name="DescriptionOfProblem"></textarea>
</div>
}
1 Answer
Steven Parker
231,275 PointsIt looks like you did too much work.
The challenge said to "render the <label> element for the "Name" field using the Html.Label method". You did that, but then you also changed the rendering of all other labels on the page.
Just modify only the field mentioned in the challenge and you should move to the next task.
Just in general, always do ONLY what a challenge asks.