
Public Class uc_Pager
    Inherits System.Web.UI.UserControl

#Region "********************** プロパティ **********************"

    Public Property PagedControlID() As String
        Get
            Return dp_pager.PagedControlID
        End Get
        Set(value As String)
            dp_pager.PagedControlID = value
        End Set
    End Property

    Public Property PageSize() As Integer
        Get
            Return dp_pager.PageSize
        End Get
        Set(value As Integer)
            dp_pager.PageSize = value
        End Set
    End Property

    Public ReadOnly Property TotalRowCount() As Integer
        Get
            Return dp_pager.TotalRowCount
        End Get
    End Property

    Public ReadOnly Property CurrentPageIndex() As Integer
        Get
            Return dp_pager.StartRowIndex \ dp_pager.MaximumRows
        End Get
    End Property

#End Region

#Region "******************* Sub及びFunction ********************"

    Public Sub SetPageIndex(ByVal index As Integer)
        Dim destination As Integer
        destination = Math.Min(Math.Max(index, 0), dp_pager.TotalRowCount \ dp_pager.MaximumRows)
        dp_pager.SetPageProperties(destination, dp_pager.MaximumRows, False)
    End Sub

    Public Sub ResetPage()
        dp_pager.SetPageProperties(0, dp_pager.MaximumRows, False)
    End Sub

#End Region

End Class