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 HTML Helpers

I did this like the example in the video but I think I deleted something important

I am getting an error that states I might have deleted an important piece of markup

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

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
<div class "form-group">
        @Html.Label("Name", new{@class = "control-label"})
        @Html.textbox ("Name", null, new{@class = form-control})
    </div>

    <div class "form-group">
        @Html.Label("Email", new{@class = "control-label"})
        @Html.textbox ("Email", null, new{@class = form-control})
    </div>

    <div class "form-group">

      @Html.Label("DepartmentId", new{@class = "control-label"})
        @Html.textbox ("DepartmentId", null, new{@class = form-control})
    </div>

    <div class "form-group">
      @Html.Label("Severity", new{@class = "control-label"})
        @Html.textbox ("Severity", null, new{@class = form-control})
    </div>

    <div class "form-group">       
      @Html.Label("Reproducible", new{@class = "control-label"})
        @Html.textbox ("Reproducible", null, new{@class = form-control})
    </div>

    <div class "form-group">

      @Html.Label("DescriptionOfProblem", new{@class = "control-label"})
        @Html.textbox ("DescriptionOfProblem", null, new{@class = form-control})
    </div>

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

}

3 Answers

Steven Parker
Steven Parker
229,732 Points

It looks like you may have done a bit more than was asked for:

  • the challenge said to " use the first method overload that accepts a single string parameter" to render the label, but your call is using two parameters.
  • the call to render the text box was similarly supposed to be the one-parameter version.
  • instead of "TextBox", you wrote "textbox" (all lower case)
  • the challenge only asked you to replace the label and input for the Name field, but you replaced them all.

in your answer to me what does this mean? --- the challenge said to " use the first method overload that accepts a single string parameter" to render the label, but your call is using two parameters.

Steven Parker
Steven Parker
229,732 Points

You wrote this:

        @Html.Label("Name", new{@class = "control-label"})
        //          -ONE--  -------------TWO-------------

As you can see from my comment, you are passing two parameters to the Label method. But the challenge says you should only have one.

Where did you get that extra parameter? Did you just cut and paste that from some other part of the lesson? You can be pretty sure that the challenges will NOT just ask you to repeat stuff done in the lesson.

ok I was able to solve the problem thank you