martijnboland / MvcPaging

ASP.NET MVC Paging HTML helper
https://blogs.taiga.nl/martijn/2008/08/27/paging-with-aspnet-mvc/
MIT License
290 stars 144 forks source link

PageRouteValueKey not working #69

Closed scascalesageinfoes closed 6 years ago

scascalesageinfoes commented 6 years ago

Hello I have this: [Route("genericos-referencias}", Order = 3, Name = "appGenericosReferenciasController.Index.es")] [Route("{lang}/generic-references}", Order = 4, Name = "appGenericosReferenciasController.Index.en")] public async Task Index() ..

I want than MVC paging generate this link in every page: http://localhost:29553/generic-references?page=2

I try set: .PageRouteValueKey("appGenericosReferenciasController.Index.en")

But always get: http://localhost:29553/genericos-referencias?page=2

Any mehtod to override base URL of links? Thanks

martijnboland commented 6 years ago

I'm afraid we don't support named routes. However, I think we could add a routename option without too much effort to make this work. Is that something you could give a try yourself with a pull request?

martijnboland commented 6 years ago

You could checkout the CustomRouteName branch, https://github.com/martijnboland/MvcPaging/tree/CustomRouteName

In this branch, the Pager has a new option .CustomRouteName(string customRouteName). See https://github.com/martijnboland/MvcPaging/commit/8819a792eccff224ee0d91d1cd6b9064a6a2fe81 for all changes, including a demo controller action and view.

Please let us know if something like this would work for you.

scascalesageinfoes commented 6 years ago

Perfect my friend! It works! Can you update the last versión of nuget with this change?

martijnboland commented 6 years ago

NuGet package is updated