Sorting and Paging in MVC
Hello.I have below code to bind table in front end.
public ActionResult Notification()
{
DAL.ClsSelfServiceDAO objSelfService = new DAL.ClsSelfServiceDAO();
List<MyNotification> objList = new List<Models.MyNotification>();
objList = objSelfService.GetSelfNotifications(180);
return View(objList);
}
In view,
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.NotificationType)
</th>
<th>
@Html.DisplayNameFor(model => model.NextActionTaker)
</th>
<th>
@Html.DisplayNameFor(model => model.Status)
</th>
<th>
@Html.DisplayNameFor(model => model.CreatedDate)
</th>
@*<th>
@Html.DisplayNameFor(model => model.HardCodeModuleId)
</th>
<th>
@Html.DisplayNameFor(model => model.OtherInfo)
</th>*@
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.NotificationType)
</td>
<td>
@Html.DisplayFor(modelItem => item.NextActionTaker)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
@*<td>
@Html.DisplayFor(modelItem => item.HardCodeModuleId)
</td>
<td>
@Html.DisplayFor(modelItem => item.OtherInfo)
</td>*@
<td>
@*@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })*@
</td>
</tr>
}
</table>
Here, I want to implement paging and sorting. Can anyone help me on this.