1
I have the following page using x.Pagedlist
@using AspNet.Models;
@using X.PagedList.Mvc
@{
ViewBag.Title = "Visualiza";
@model X.PagedList.IPagedList<AspNet.Models.Pessoa>
}
<h2>Pessoas Cadastradas</h2>
<div class="table-responsive">
<table class="table table-bordered table-hover table-inverse">
<thead>
<tr>
<th>Nome</th>
<th>Idade</th>
<th>Usuario</th>
<th>Setor</th>
<th>Sub Setor</th>
<th>Editar</th>
</tr>
</thead>
<tbody>
@foreach (Pessoa pessoa in Model)
{
<tr>
<td>@pessoa.nome</td>
<td>@pessoa.idade</td>
<td>@pessoa.usuario</td>
<td>@pessoa.setor</td>
<td>@pessoa.sub_setor</td>
<td>@Html.ActionLink("Editar", "Edita", "Pessoa", new {
@id_pessoa = pessoa.id_pessoa }, null)</td>
</tr>
}
</tbody>
</table>
</div>
Página @Model.PageNumber de @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Visualiza","Pessoa", new
{pagina = page}) + "&setor=" + ViewBag.setor)
Note that in the URL.Action above I am passing two GET parameters, the page and the sector... when the page is generated, it generates the link of get:
However, when I go to page 2 and want to go back to 1, it loses the get sector:
Can someone help me with this?
I got it done. i was specifying the wrong action... the correct one would be @Html.Pagedlistpager(Model, page => Url.Action("Viewbag","Person", new {page = page}) + "§or=" + Viewbag.sector)
– maiconfriedel
Answers your question with that answer to document.
– Andre Mesquita