Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To demonstrate the key jQuery features, we have created a simple MVC Framework application that lists mountain summits and their heights. Given that jQuery is a client-side technology, we will focus on the Razor view and HTML that this application generates. Listing 20-1 shows the view.
@using MvcApp.Models;
@model IEnumerable<Summit>
@{
ViewBag.Title = "List of Summits";
}
<h4>Summits</h4>
<table>
<thead><tr><th>Name</th><th>Height</th><th></th></tr>
</thead>
@foreach (Summit s in Model) {
<tr>
<td>@s.Name</td>
<td>@s.Height</td>
<td>
@using (Html.BeginForm("DeleteSummit", "Home")) {
@Html.Hidden("name", @s.Name)
<input type="submit" value="Delete" />
}
</td>
</tr>
}
</table>
@Html.ActionLink("Add", "AddSummit")
@using (Html.BeginForm("ResetSummits", "Home")) {
<input type="submit" value="Reset" />
} |