HTML and CSS Reference
In-Depth Information
<!DOCTYPE html>
<meta name="viewport" content="width=device-width" />
@using (Html.BeginForm((string)ViewBag.FormAction, "Home"))
<legend>Feedback Form</legend>
@Html.EditorFor(m => m.Email)
<input type="submit" value="Submit" />
3. Views are invoked by a controller so you'll need to add a controller action that
will load this page. open the HomeController.cs class, which you'll find in the
Controllers folder.
4. Add the following method:
public ActionResult Feedback()
return View();
5. Finally, you'll need a link that triggers this controller action. open the _Layout.cshtml
in the View\shared folder.
6. Add the line shown in bold:
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
<li>@Html.ActionLink("Feedback", "Feedback", "Home")</li>
7. save your changes and press F5 to debug. You should now have a Feedback link on
the home page as shown in Figure 3-8 .
Search WWH ::

Custom Search