HTML and CSS Reference
In-Depth Information
Completing the Feedback Form
Now you'll add the remaining fields to the feedback form. You'll also need to provide editor templates for the
additional data types. I'll also show you how the framework determines which template to use.
Adding the Other Fields
You'll start by adding the other fields that are defined in the
FeedbackModel.cs
class. For each one you'll include
a label and use the
EditorFor()
method to generate the input field.
eXerCISe 3-3. COMpLetING the FeeDBaCK FOrM
1.
open the
Feedback.cshtml
file and add the code shown in bold in listing 3-4.
Listing 3-4.
The Feedback view implementation
<div>
@Html.EditorFor(m => m.Email)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Name)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Name)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Birthday)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Birthday)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Homepage)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Homepage)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Phone)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Phone)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.Score)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Score)
</div>