ASP.Net : DataPager Control always a step behind with paging

后端 未结 6 933
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 16:28

Take the following example...a page with a ListView and a DataPager used for paging the data of the ListView:

Code Behind:

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 17:12

    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
    
    
    

提交回复
热议问题