Take the following example...a page with a ListView
and a DataPager
used for paging the data of the ListView
:
Code Behind:
Following works perfect for me.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ds As DataSet
ds = SQLHELPER.ExecuteDataSet(CommandType.StoredProcedure, "sp_Locations")
rs.EnableViewState = False
rs.DataSource = ds
rs.DataBind()
End Sub
Protected Sub rs_PagePropertiesChanging(ByVal sender As Object, ByVal e As PagePropertiesChangingEventArgs)
'set current page startindex, max rows and rebind to false
Pager.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
'rebind List View
rs.DataBind()
End Sub