Using SearchDataSource with the ASP.NET DataPager and ListView Controls



Can anyone confirm if the SearchDataSource control supports paging functionality with the ASP.NET DataPager and ListView controls?

I'm trying to get them to work together with no joy. Basically, when I click on say, page 2 of the pager, the same results are shown on page 2 as were shown on page 1. The DataPager certainly restricts the page size, e.g. if I tell it to return 10 items per page this does seem to work.

I have run into this problem before when not using SearchDataSource and it was solved by re-binding the ListView on the PagePropertiesChanged event. This does not seem to work in this case.

Any ideas or comments?

Thanks a lot,


Nov 18, 2010 18:08

The solution here seems to be to use the select method of the SearchDataSource in the code behind of your page:

1. In the OnPreRender event of your page do your initial databinding e.g.:

myListView.DataSource = mySearchDataSource.Select(DataSourceSelectArguments.Empty);

2. Add an event handler for your ListView's PagePropertiesChanged event to rebind the ListView e.g.:

private void myListView_PagePropertiesChanged(object sender, EventArgs e)
     myListView.DataSource = mySearchDataSource.Select(DataSourceSelectArguments.Empty);

Bingo, your DataPager should now work correctly.


Nov 19, 2010 13:50

Confirmed. Without this I was unable to get DataPager to work with SearchDataSource (it shows first page no mater what i put in the querystring)

Edited, Apr 27, 2011 13:44
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.