Search code examples
asp.net-mvcpagination

Building pagination in MVC: Is there anyway to get something like an Html.HyperLinkFor


What I mean by that is a type element that will have a label based on a value in my viewModel and also be able to submit that value back up to the viewModel so it can grab new results based on Current Page and Page Size. This is for creating a gridview in MVC that supports pagination.

None of the examples I've seen of MVC so far have had anything resembling a gridview. It's important that I create my own paging and not use any built in paging mechanisms or third party controls or html helpers or the like


Solution

  • I'd go with ActionLink. To build Urls you can either use Url.Action or Html.BuildUrlFromExpression(c => c.conTrollerAction)