我试图在jQuery中生成下表,以基于ajax搜索用分页器填充表。
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">City</th>
<th scope="col"></th>
</tr>
</thead>
<tbody id="SearchData">
@foreach (var area in Model)
{
<tr>
<th scope="row">
@Html.DisplayFor(modelItem => area.Id)
</th>
<td>
@Html.DisplayFor(modelItem => area.Name)
</td>
<td>
@Html.DisplayFor(modelItem => area.City.Name)
</td>
<td>@Html.ActionLink("More", "Details", "Area", new { id = area.Id }, null)</td>
</tr>
}
</tbody>
</table>
</div>
<hr />
<label id="PageNumber">
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) / @Model.PageCount
</label>
<div style="margin-top:-15px;" id="Pager">
@Html.PagedListPager(Model, page => Url.Action("AreaList", new { page = page }))
</div>