Dude, from what I understand, you want me to show you a list of 10 users and then pass the page on that list, that’s it?
I made an example using Pagedlist.
I’ll leave an example of how I managed to do.
In the controller I did like this:
using Pagedlist;
public ActionResult Index(int? pagina)
{
var ListaEventos = db.Objetos.Tolist();
int PaginaTamanho = 4; //<<<<<Tamanho de objetos na pagina(no seu caso coloca 10)
int paginaNumero = (pagina ?? 1);
return View(ListaEventos.ToPagedList(paginaNumero, PaginaTamanho));
Already in html I just put this like this:
Page @(Model.Pagecount < Model.Pagenumber ? 0 : Model.Pagenumber)
@Model.PageCount
@if (Model.HasPreviousPage)
{
@Html.ActionLink("<<", "Index", new { pagina = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { type = "button", @class = "btn btn-info", style = "background-color: #009688" })
@Html.Raw(" ");
@Html.ActionLink("< Previous", "Index", new { pagina = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter },new {type= "button", @class = "btn btn-info", style = "background-color: #009688" })
}
else
{
@:<button type="button" class="btn btn-info" style="background-color: #009688"><<</button>
@Html.Raw(" ");
@:<button type="button" class="btn btn-info" style="background-color: #009688">Previous</button>
}
@if (Model.HasNextPage)
{
@Html.ActionLink("Next ", "Index", new { pagina = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter } , new { type = "button", @class = "btn btn-info" , style = "background-color: #009688" })
@Html.Raw(" ");
@Html.ActionLink(">>", "Index", new { pagina = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { type = "button", @class = "btn btn-info", style = "background-color: #009688" })
}
else
{
@:<button type="button" class="btn btn-info" style="background-color: #009688">Next</button>
@Html.Raw(" ")
@:<button type="button" class="btn btn-info" style="background-color: #009688">>></button>
}
I hope I’ve helped!
Henry, if possible post what you’ve tried so far, it’s easier for people to help you.
– William Cézar
I haven’t tried anything because I have no idea how to do this, I’m looking on youtube and forums to see if I can find something related
– Henrique SP
Do you want to do this in a web application right? You can already fetch customers in the database?
– Cassio Alves
No, it’s a PC program even with no relation to any browser, and yes I can search in DB
– Henrique SP