I'm facing a problem with two Datapagers associated with a Listview. This is my page:
<asp:DataPager ID="PagerTop" runat="server" PagedControlID="pp" QueryStringField="page" PageSize="30"></asp:DataPager>
<asp:ListView ID="pp" runat="server" ItemPlaceholderID="holder" EnableViewState="true" OnPagePropertiesChanging="PagePropertiesChanging">
...
</asp:ListView>
<asp:DataPager ID="PagerBottom" runat="server" PagedControlID="pp" QueryStringField="page" PageSize="30"></asp:DataPager>
and the code behind is as follows
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
Dim MyData As List(Of Product)
MyData = ResultsManager.GetResults()
pp.DataSource = MyData
pp.DataBind()
End Sub
Private Sub PagePropertiesChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.PagePropertiesChangingEventArgs)
PagerTop.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
PagerBottom.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
pp.DataBind()
End Sub
When I change the page, the listview is updated and shows the results corresponding with the indicated page, and PagerTop
shows the selected page. That's how they are supposed to work. But PagerBottom
is stucked on page 1 and never changes!
It doesn't matter which pager I click, PagerTop
always works and PagerBottom
always stays at page 1.
I'm running out of brilliant ideas... what can be wrong here?
a very good example is given here http://www.c-sharpcorner.com/uploadfile/nipuntomar/datapager-in-Asp-Net-3-5/ just place another data pager with different id without any change. i have tried and worked fine for me.