Written in ASCX. After 9CBS, I saw a lot of DataGrid page issues. Of course, DataGrid has its own pagination item. The function is very limited. I also read a lot of my own code on 9cbs. I found that I wrote it with C #, I wrote a Use ASP. Written in the VB in NET. The following code is for your reference.
HTML code: <% @ Control Language = "vb" AutoEventWireup = "false" Codebehind = "DataGridPage.ascx.vb" Inherits = "datagridfenye.DataGridPage" TargetSchema = "http://schemas.microsoft.com/intellisense/ie5" %> font> Borderwidth = "1px" causesvalidation = "false" backcolor = "# e0e0e0" font-size = "xx-small"> asp: button> Imports SystemImports System.DataImports System.DrawingImports System.TextImports System.WebImports System.Web.UI.WebControlsImports System.Web.UI.HtmlControlsPublic Delegate Sub BindDataDelegate () Public Class DataGridPage Inherits System.Web.UI.UserControl #Region "Web fu ォ イ na za video game, one woods生 れ コ コ ド "" こ こ び し は Web フォ フォ ム ム で で 必 必 要 要 必 必 必 必... ナ ナ ナ ナ ナ ナ ナ.. ナ ナ.. ナ ナ ナ ナ デザ. ナ ナ. ナ ナ ナ. ナ ナ ナ ナ ナ ナ ナ デザ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ ナ. ナ. ナ ナ ナ ナ ナ ナ デザ ナ ナ ナ ナ ナ デザ デザ Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: ko の メ Toso t do the call び Web fu shi wa ォ one woods cropped by Du za イ で necessary desu. 'コ コ ド ド エディ っ っ て 変 変.. くだ くだ くだ くだ くだ い っ くだ くだ い い くだ いInitializeComponent () AddHandler Me.Load, AddressOf Page_Load End Sub #End Region Public Property Target () As DataGrid Get Return _dg End Get Set (ByVal Value As DataGrid) _dg = Value End Set End Property Public Property AutoHidden () As Boolean Get Return _autohidden End Get Set (ByVal Value As Boolean) _autohidden = Value End Set End Property Public Property PageSize () As Integer Get Return _pagesize End Get Set (ByVal Value As Integer) _pagesize = Value End Set End Property Public Property ItemCount () As Integer Get Return _itemcount End Get Set (ByVal Value As Integer) _itemcount = Value End Set End Property Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'pe ー ji initial wo of suru yu ー za ー U one then woここ に にInsert it. End Sub Public Sub SetTarget (ByVal adg As DataGrid, ByRef aBindData1 As BindDataDelegate) _dg = adg binddata1 = aBindData1 AddHandler btnNavFirst.Click, AddressOf NavigationButtonClick AddHandler btnNavPrevious.Click, AddressOf NavigationButtonClick AddHandler btnNavNext.Click, AddressOf NavigationButtonClick AddHandler btnNavLast.Click, AddressOf NavigationButtonClick AddHandler btnNavGo.Click, AddressOf NavigationButtonClick AddHandler _dg.DataBinding, AddressOf zxDataBinding binddata1 () End Sub Public Sub SetStyle (ByVal aPageSize As Integer, ByVal aAutoHidden As Boolean, ByVal aDispStyle As Integer) _pagesize = aPageSize _autohidden = aAutoHidden _dispStyle = aDispStyle divPanel.Visible = NOT AAUTOHIDEN End Sub Public Sub SetStyle (Byval Aautohidden As Boolean) SetStyle (ApageSize, Aautohidden, 1) End Sub Public Sub SetStyle (Byval APA geSize As Integer) SetStyle (aPageSize, True) End Sub Public Sub NavigationButtonClick (ByVal sender As Object, ByVal e As System.EventArgs) Dim direction As String direction = sender.CommandName Select Case (direction.ToUpper ()) Case ( "FIRST ") _dg.CurrentPageIndex = 0 Case (" PREVIOUS ") _dg.CurrentPageIndex = math.Max (_dg.CurrentPageIndex - 1, 0) Case (" NEXT ") _dg.CurrentPageIndex = math.Min (_dg.CurrentPageIndex 1, _dg .Pagecount - 1) case ("last") _dg.currentpageIndex = Math.max (_dg.pagecount - 1, 0) case ("go") try _dg.currentpageIndex = math.min (_dg.pagecount - 1, cint (tbpage.text) - 1) TBPage.Text = "" Catch TBPAGE .Text = "" End Try End Select binddata1 () End Sub Public Sub zxDataBinding (ByVal sender As Object, ByVal e As System.EventArgs) Dim newCount As Integer = 0 Dim PageCount As Integer = 0 If (_dg.DataSource Is "null ") The setButtonState (0) EXIT SUB END IF (_dg.datasource.gettype (). TOSTRING (). TOLOWER () =" System.data.DataTable ") Then newcount = _dg.datasource.Rows.count Elseif (_dg .Datasource.gettype (). TOSTRING (). TOLOWER () = "system.data.dataview") Then newcount = _dg.datasource.count elseif (_dg.datasource.gettype (). Tostring (). TOLOWER () = " System.Data.Dataset ")") ")") THEN newcount = _dg.datasource.t Aables (0) .ROWS.COUNT End End End End End End = CINT ((NewCount - 1) / _PageSize) IF (_dg.currentpageindex> PageCount - 1) Then_dg.currentpageIndex = PageCount - 1 END IF ELSE PageCount = 0 _dg.currentpageindex = 0 End if select case (_dispstyle) case 1 labelmsg.text = "Total" PageCount.toString () "page" (_dg.currentpageIndex 1) .tostring () page "Labelmsg.text =" total record? Number: "