Search code examples
asp.netvb.netlistviewdatapager

ASP.NET DataPager not working with ListView


I have a problem with DataPager with ListView, I am using ASP.NET with VB.NET. I have searched for the answer, but I just can't seem to get it to work. Whenever I binded the data, the front page was okay, tried second page, still the same data, etc. Then I tried rebinding the data each time pager was changed, the listview dissapeared.

About the code: When a call is made to the UserInterface, to get statistics, it calls DataLayer, to get the test points to a List (Of KeyValuePair(Of String, Integer), reason I used List of KeyValuePair, was due to the need of index-based collection. Dictionary didn't provide it as such. Then the testpoints get the description, and number of failed test points. Then UserInterface binds it.

I put the entire related code to pastebin, hope you don't mind:

http://pastebin.com/stjAi9c2

I have been trying to fix it for many hours, hope anyone can point me in the right direction. Thank you.


Solution

  • Protected Sub ListView1_PagePropertiesChanging(ByVal sender As Object, ByVal e As     System.Web.UI.WebControls.PagePropertiesChangingEventArgs) Handles ListView1.PagePropertiesChanging
    
        DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false)
    
        userInterface.ListViewReBind(ListView1)
    
    End Sub