MVC Blog: Pagination


Garry West
09/09/2024

For paging, I first right-clicked on the MvcBlog project, and did Add >> New Folder to create an Infrastructure folder:

I then created a PaginatedList class, \Infrastructure\PaginatedList.cs:

Adjust the Index action in BlogPostController:

Update \Models\ViewModels\BlogPostViewModel to use the new class:

Persist the currentFilter when sorting in \Views\BlogPost\Index.cshtml:

Add Previous and Next buttons to \Views\BlogPost\Index.cshtml (get icon SVN values from the Bootstrap site):

blog , mvc