|
05 November 2012 |
ListView Paging in ASP.Net |
|
I have been using Gridview.PageIndex to select the desired page via a querystring on loading for years but had trouble working out the equivalent for a ListView. It turns out you have to set via the ListView's DataPager properties:
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If (IsPostBack = False) Then
Dim i As Integer = [Convert].ToInt32(Request.QueryString("Page"))
Dim myPager As DataPager = ListView1.FindControl("myPager")
If (i >= 0) Then
myPager.SetPageProperties(i, myPager.MaximumRows, True)
End If
End If
End Sub
Simples!
|
Jack at 10:34 |
(0) Comments |
Leave a comment
|
|
| |