Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddRouteValue and RouteValues conflict #38

Open
M1chae1 opened this issue May 28, 2014 · 0 comments
Open

AddRouteValue and RouteValues conflict #38

M1chae1 opened this issue May 28, 2014 · 0 comments

Comments

@M1chae1
Copy link

M1chae1 commented May 28, 2014

I am using MvcPaging 2.1.0 downloaded by nuget

@Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount,
    new AjaxOptions
    {
        UpdateTargetId = "PreOrderListContainer",
        OnSuccess = "indexAjaxCallback"
    }).Options(
        o => o.Action("IndexAjax")
              .AddRouteValue("sortOrder", ViewBag.sortOrder)
              .RouteValues(ViewBag.RouteValueDict)
              .DisplayTemplate("Bootstrap3Pagination")
              .MaxNrOfPages(10)
              .AlwaysAddFirstPageNumber()
)

The above pager will ignore the route value provided by AddRouteValue("sortOrder", ViewBag.sortOrder). i.e. the sortOrder will not be exists in the pager link generated.

I change Pager.Options lambda as below, i.e. use RouteValues before AddRouteValues.

o => o.Action("IndexAjax")
      .RouteValues(ViewBag.RouteValueDict)
      .AddRouteValue("sortOrder", ViewBag.sortOrder)
      .DisplayTemplate("Bootstrap3Pagination")
      .MaxNrOfPages(10)
      .AlwaysAddFirstPageNumber()

Both of the route values provided by RouteValues and AddRouteValue will be exists in the pager link generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant