Hi, I'm trying to implement a paging and sorting list in ASP.NET MVC without using MVContrib grid or javascript (needs to be seo friendly).
I have constructed my action with the following signature:
ActionResult List(int? page, string sort, string direction);
The problem I have though is getting both the paging and the sorting to work. Say for example I have the following code:
<%= Html.ActionLink("Title", "List", new { sort = "Title", direction = "ASC" }) %>
I hoped this would generate a url containing all of the existing route values (including the current page) but it doesn't. Therefore when you click on the link the page is set back to null.
I have looked at all the overloads for the ActionLink helper but nothing looks like it will help. What I effectively need to do is generate a url/link with the existing page value (or potentially any other route values) and the new sort parameters.
I'd appreciate it if someone could help. Thanks.