How to page while maintaining the querystring values in ASP.Net Mvc 2
Posted
by Picflight
on Stack Overflow
See other posts from Stack Overflow
or by Picflight
Published on 2010-04-12T22:31:01Z
Indexed on
2010/04/12
22:32 UTC
Read the original article
Hit count: 588
asp.net-mvc-2
|pagination
I am using the pager provided by Martijin Boland to implementing paging in my Asp.Net Mvc 2 application.
My form uses the GET method to send all parameters to the querystring, it is a search form with several form elements.
<% using (Html.BeginForm("SearchResults", "Search", FormMethod.Get))
{%>
On the SearchResults View I am trying to implement paging:
<div class="pager">
<%= Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount,
new { Request.QueryString })%>
</div>
The Html.Pager has some overloads which I am not too clear on how to use. The Request.QueryString makes the querystring look like this:
http://localhost:1155/Search/SearchResults?QueryString=Distance%3D10%26txtZip%3D%26cb&page=2
Should it not be like this?
http://localhost:1155/Search/SearchResults?Distance=20&txtZip=10021&page=2
© Stack Overflow or respective owner