'Place your Imports here Partial Public Class Custom_Paging Inherits System.Web.UI.Page ' Place your TableAdapter Here Public taTableAdapter As TableAdapters.TableTableAdapter ' Place your DataTable Here Public tbDataTable As DataTable Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ' Insert initial page load logic here End If End Sub Protected Sub gvSelDate_RowCommand(ByVal sender As Object, ByVal e As EventArgs) 'Row Command Event logic here End Sub Private Sub gvSelDate_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvSelDate.DataBound ' When GridView is bound to data, put your logic here ' As of 3/10/2010 this was my current approach to getting the current page ' section of the pager bottom row Dim cntrls As ControlCollection = gvSelDate.BottomPagerRow.Controls If cntrls.Count = 1 Then cntrls = cntrls(0).Controls End If For Each ctrl As Control In cntrls If TypeOf ctrl Is Label Then If CType(ctrl, Label).ID = "lblCurr" Then CType(ctrl, Label).Text = (gvSelDate.PageIndex + 1).ToString & " " ElseIf CType(ctrl, Label).ID = "lblTotal" Then CType(ctrl, Label).Text = " " & gvSelDate.PageCount.ToString End If End If Next End Sub Private Sub gvSelDate_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvSelDate.PageIndexChanged 'Databind the GridView after the PageIndex is changed gvSelDate.DataBind() End Sub Private Sub gvSelDate_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvSelDate.PageIndexChanging 'Is triggered when one of the Buttons with CommandName="Page" is clicked 'Requery the Database for the information gvSelDate.DataSource = BindData() 'Set the current PageIndex to the NewPageIndex gvSelDate.PageIndex = e.NewPageIndex End Sub Protected Function BindData() As DateTableDataTable If taTableAdapter Is Nothing Then taTableAdapter = New TableAdapter End If tbDataTable = New DataTable 'Refer to post: http://woodassoc.us/blog/b2e/index.php/prog/2010/03/10/runtime-method-class-call ' for explanation Dim tmpMethod As String = "Get" Dim tmpParameters() As Object tmpMethod &= core.Type.ToString If Not (core.Shift = Nothing) Then tmpMethod &= "ByShift" tmpParameters = New Object() {CType(core.Line, Byte), CType(core.Shift, Byte)} Else tmpParameters = New Object() {CType(core.Line, Byte)} End If 'assign the associated method to the DataTable tbDataTable = core.InvokeMethod(Of DataTable)(taTableAdapter, tmpMethod, tmpParameters) Return tbDataTable End Function End Class