Imports system.data.sqlclient
Imports system.data
Imports System.Web.ui
Public class ucdatagridpage
Inherits System.Web.ui.userControl
Protected withevents btnfirst as system.Web.ui.WebControls.LinkButton
Protected Withevents Btnprev as system.Web.ui.WebControls.LinkButton
Protected Withevents Btnnext As System.Web.ui.WebControls.LinkButton
Protected withevents btnlast as system.Web.ui.WebControls.LinkButton
Protected Withevents LblcurrentIndex as System.Web.ui.WebControls.label
Protected Withevents LBLPAGECUNT As System.Web.ui.WebControls.label
#Region "Web Form Designer Generated Code"
'This Call is Required by the Web Form Designer.
End Sub
Private sub page_init (byval sender as system.object, byval e as system.eventargs) Handles mybase.init
'Codegen: This Method Call is Required by the Web Form Designer
'Do Not Modify It Using The Code Editor.
InitializeComponent ()
End Sub
#End region
Protected withevents uc_datagrid as system.Web.ui.WebControls.DataGrid
Public Writeonly Property DataGridName () AS DataGrid
Set (ByVal Value As DataGrid)
UC_DataGrid = Value
End set
End Property
Private Sub Page_Load (Byvale AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load
btnfirst.text = "The most?"
Btnprev.text = "Previous?"
BTNNEXT.TEXT = "Next?"
btnlast.text = "Last?"
Showstats ()
End Sub
Sub PagerButtonClick (Byval E AS Object, Byval E As Eventargs)
'use by external paging ui
Dim arg as string = sender.commandargument
SELECT CASE ARG
Case "Next"
IF (uc_datagrid.currentpageindex <(uc_datagrid.pagecount - 1)) Thenuc_DataGrid.currentPageIndex = 1
END IF
Case "prev"
IF (uc_datagrid.currentpageindex> 0) THEN
UC_DataGrid.currentPageIndex - = 1
END IF
Case "Last"
UC_DataGrid.currentpageIndex = (uc_datagrid.pagecount - 1)
Case Else
'Page Number
UC_DataGrid.currentpageIndex = system.convert.toint32 (arg)
End SELECT
Bindgrid ()
Showstats ()
End Sub
Sub bindgrid ()
UC_DataGrid.Database
Showstats ()
End Sub
SUB ShowStats ()
LBLCurrentIndex.text = "Part" (uc_datagrid.currentpageindex 1) .tostring () "?"
LBLPAGECOUNT.TEXT = "? total" uc_datagrid.pagecount.tostring () "?"
End Sub
END CLASS