How show count items results in index cshtml, have a paginatedlist guide microsoft mvc
count results in query
var totalregistros= _context.users.Tolist()
return view(totalregistros)
the problem return in view have a pagination
return View(await PaginatedList<users>.CreateAsync(students.AsNoTracking(), pageNumber ?? 1, pageSize));
i need example that show
i need this
CodePudding user response:
Add a TotalItems or similar int property to your PaginatedList class, populate it with the count, and then display that. Additionally, the tutorial from Microsoft shows how to add page counts:
Also, you are returning a List<users> to your view as the view model. Don't do that. Return a view model that has all of the properties that you want to display, including total count, etc.


