分页实现的代码:
数据库创建一个表为Role,列名分别为ID,Name,Remark,为此加上数据,进行分页实现
@{
ViewBag.Title = "Index";
}
<h2>视图界面展示</h2>
<div class="input-group">
<label>名称:</label>
<input type="text" class="form-control" id="txtCondName" value="@ViewBag.name"/>
<input type="button" id="btnSearch" value="搜索" onclick="page(1);" />
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>备注</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<th>@item.ID</th>
<th>@item.Name</th>
<th>@item.Remark</th>
</tr>
}
</tbody>
</table