Skip to content

Conversation

Copy link

Copilot AI commented Jan 22, 2026

The pager should support placing the first link immediately after “previous” and the last link immediately before “next,” keeping first/last always visible.

  • Added render option PlaceFirstPageAfterPreviousAndLastPageBeforeNext (default false) to control ordering.
  • Updated pager construction to honor the new ordering while preserving previous defaults.

Example:

@Html.PagedListPager(
    list,
    page => Url.Action("Index", new { page }),
    new PagedListRenderOptions
    {
        DisplayLinkToFirstPage = PagedListDisplayMode.Always,
        DisplayLinkToLastPage = PagedListDisplayMode.Always,
        PlaceFirstPageAfterPreviousAndLastPageBeforeNext = true
    })
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow changing order of pager elements.</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
The client would like the pager format to be {previous} {firstpage} {...} {page numbers} {...} {lastpage} {next}, with the first page and last page elements always visible.

Describe the solution you'd like
Allow programmer to be able to use this format via configuration option.

Describe alternatives you've considered
Fork the source code and rearrange the code in HtmlHelper to show the firstpage text after the "previous" text, and the last page text before the "next" text.

Additional context
I hope this is enough explaination.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: a-gubskiy <3822922+a-gubskiy@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow configuration for pager element order Allow pager to place first/last links inside prev/next cluster Jan 22, 2026
Copilot AI requested a review from a-gubskiy January 22, 2026 08:47
@a-gubskiy a-gubskiy marked this pull request as ready for review February 9, 2026 08:25
@a-gubskiy a-gubskiy requested a review from Copilot February 9, 2026 08:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new render option to control the ordering of “first/last” links relative to “previous/next” links in the ASP.NET Core MVC pager, enabling a {prev} {first} ... {last} {next} layout while preserving the existing default order.

Changes:

  • Added PlaceFirstPageAfterPreviousAndLastPageBeforeNext to PagedListRenderOptions (default false).
  • Updated pager rendering logic to conditionally reorder the first/previous and last/next link clusters based on the new option.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/X.PagedList.Mvc.Core/PagedListRenderOptions.cs Introduces a new boolean render option (defaulting to existing behavior).
src/X.PagedList.Mvc.Core/HtmlHelper.cs Implements the conditional ordering for first/prev and last/next link rendering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Allow changing order of pager elements.

2 participants