so using EF4 I create a scaffolding controller/view, so my question is how can I Add Paging to my view in easy/fast way?? the controller generated
public ViewResult Index()
{
return View(db.Perifericos.ToList());
}
the view: generated
@model IEnumerable<Paginacion.Models.Perifericos>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
Nombre
</th>
<th>
Modelo
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Nombre)
</td>
<td>
@Html.DisplayFor(modelItem => item.Modelo)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.idPerifericos }) |
@Html.ActionLink("Delete", "Delete", new { id=item.idPerifericos })
</td>
</tr>
}
</table>
Maybe this can help you: http://www.asp.net/entity-framework/tutorials/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application
You have to implement a paging in controller and in the view add code like the link that i have given to you.