ANP
ANP

Reputation: 15607

Datapager for listview always goes to page 1 of results

I am using a Listview and Datapager control. But when I refresh the page it always set the datapager to page 1. I want that it should be in the same page after refreshing. For example I want the same functionality as stackoverflow is having like: https://stackoverflow.com/questions/tagged/datapager. How to do this can any one help.

Upvotes: 0

Views: 1536

Answers (1)

user212218
user212218

Reputation:

Try specifying a value for the QueryStringField parameter in your DataPager:

<asp:DataPager ... QueryStringField="page">

This will convert all paging controls for that DataPager into hyperlinks, and the page number will be passed in the URL query string (in the example above, the URL will look like e.g., "http://www.example.com/search.aspx?query=xyz&page=2").

See this MSDN article for more information.

Upvotes: 2

Related Questions