In my custom Orchard module I have a child action only method in my controller that returns a partial containing tabular data that needs to be paged. I’ve added the pager shape to the view model and it displays fine and shows the 10 rows I expect to see. The problem occurs when I click through to page 2 and the URL is for the child action rather than the containing view. My question is: Can I change the URL that the Orchard pager shape uses if it’s embedded in a partial accessed via a ChildActionOnly attribute? I’m using Orchard 1.6.
Share
Solved. The problem is that the pager shape takes the route info from ViewContext. By overriding Pager.cshtml in my theme, I was able to update the RouteData used by the Pager shape with the Parent context if there is one. If the Pager is used on a view that has no parent, it will use ViewContext as normal. If it is used on a child action, it will use the Parent view context. I took Pager.cshtml from the Admin theme into my theme and modified this line: