HTML and CSS Reference
In-Depth Information
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Feedback</title>
</head>
<body>
<div>
@using (Html.BeginForm((string)ViewBag.FormAction, "Home"))
{
<fieldset>
<legend>Feedback Form</legend>
<div>
@Html.EditorFor(m => m.Email)
</div>
<p>
<input type="submit" value="Submit" />
</p>
</fieldset>
}
</div>
</body>
</html>
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>
</ul>
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