| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 702 人关注过本帖
标题:[求助]谁有DATAGRID分页的源代码啊.?
只看楼主 加入收藏
scindy
Rank: 1
等 级:新手上路
威 望:1
帖 子:591
专家分:4
注 册:2006-10-23
结帖率:50%
收藏
 问题点数:0 回复次数:3 
[求助]谁有DATAGRID分页的源代码啊.?
谁有DATAGRID分页的源代码啊.?

ASP.NET(VB.NET)版的?
搜索更多相关主题的帖子: 源代码 DATAGRID 
2006-10-23 13:11
lian8088
Rank: 1
等 级:新手上路
威 望:1
帖 子:101
专家分:0
注 册:2006-8-21
收藏
得分:0 

跟DataGrid一样


2006-10-23 14:32
上炕不脱鞋
Rank: 1
等 级:新手上路
威 望:1
帖 子:332
专家分:0
注 册:2006-3-19
收藏
得分:0 

存储过程

CREATE PROCEDURE Page
@PageNo int, --页数
@PageSize int --页大小4
AS

Declare @sN varchar(10)
Declare @sNP varchar(10)

Set @sN=Convert(varchar(10), @PageSize)
Set @sNP=Convert(varchar(10), (@PageNo-1)*@PageSize)
print('Select top '+@sN+' * From Titles ' +
'Where title_ID not in(Select top '+@sNP+' title_ID From Titles order by title_ID) order by title_ID')

Exec('Select top '+@sN+' * From Titles ' +
'Where title_ID not in(Select top '+@sNP+' title_ID From Titles order by title_ID) order by title_ID')
GO


新建的群(C#):23384106 验证注明
2006-10-23 14:52
凌枫影
Rank: 2
等 级:新手上路
威 望:3
帖 子:163
专家分:0
注 册:2006-5-10
收藏
得分:0 

Namespace PRB.PRB

Public Class GridControl

#Region "Declare Region"

Dim _DataGrid As DataGrid
Public Delegate Sub _DataBind()
'Public Event _ResetDataSource As _DataBind
Public _ResetDataSource As _DataBind
#End Region

#Region "構造函式"

''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: GridPagingNation()
''' function說明:構造函式
''' </summary>
''' <param name="obj_DataGrid">執行分頁的DataGrid</param>
''' <param name="e_aResetDataSource">重加載數據源的方法回調</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Sub GridPagingNation(ByVal obj_DataGrid As DataGrid, ByVal e_aResetDataSource As _DataBind)

_ResetDataSource = e_aResetDataSource
_DataGrid = obj_DataGrid
Dim i_Current As Integer
i_Current = obj_DataGrid.CurrentPageIndex

End Sub
#End Region

#Region "Definition Public Methods"
''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: Previous()
''' function說明:上一頁
''' </summary>
''' <param name="btnPrevious">上一頁Button</param>
''' <param name="btnNext">下一頁Button</param>
''' <param name="e_aResetDataSource">重加載數據源的方法回調</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Function Previous(ByVal btnPrevious As LinkButton, ByVal btnNext As LinkButton) 'ByVal e_aResetDataSource As _DataBind

Dim i_Current As Integer
Dim i_MaxPage As Integer

i_Current = _DataGrid.CurrentPageIndex
i_MaxPage = _DataGrid.PageCount - 1
btnNext.Enabled = True
If (i_Current = 0) Then

_DataGrid.Page.RegisterStartupScript("GridPaginationError", "<script>alert('已到頁首!')</script>")

Else

i_Current = i_Current - 1
If (i_Current = 0) Then
btnPrevious.Enabled = False
Else
btnPrevious.Enabled = True
End If

_DataGrid.CurrentPageIndex = i_Current
_ResetDataSource.Invoke()

End If

End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: NextPage()
''' function說明:構造函式
''' </summary>
''' <param name="btnPrevious">上一頁Button</param>
''' <param name="btnNext">下一頁Button</param>
''' <param name="DataTable">數據源</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Function NextPage(ByVal btnPrevious As LinkButton, ByVal btnNext As LinkButton)


Dim i_Current As Integer
Dim i_MaxPage As Integer
Dim dt As DataTable

i_Current = _DataGrid.CurrentPageIndex
i_MaxPage = _DataGrid.PageCount - 1
btnPrevious.Enabled = True
If (i_Current = i_MaxPage) Then

_DataGrid.Page.RegisterStartupScript("GridPaginationError", "<script>alert('已到頁尾!')</script>")

Else
i_Current = i_Current + 1

If (i_Current = i_MaxPage) Then
btnNext.Enabled = False
Else
btnNext.Enabled = True
End If
_DataGrid.CurrentPageIndex = i_Current
_ResetDataSource.Invoke()
End If
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: FristPage()
''' function說明:第一頁
''' </summary>
''' <param name="btnPrevious">上一頁Button</param>
''' <param name="btnNext">下一頁Button</param>
''' <param name="DataTable">數據源</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Function FristPage(ByVal btnPrevious As LinkButton, ByVal btnNext As LinkButton)
Dim i_Current As Integer
Dim i_MaxPage As Integer
i_Current = _DataGrid.CurrentPageIndex
i_MaxPage = _DataGrid.PageCount - 1
If i_Current = 0 Then

_DataGrid.Page.RegisterStartupScript("GridPaginationError", "<script>alert('已到頁首!')</script>")

Else

_DataGrid.CurrentPageIndex = 0
_ResetDataSource.Invoke()
btnPrevious.Enabled = False
btnNext.Enabled = True

End If

End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: LastPage()
''' function說明:最後一頁
''' </summary>
''' <param name="btnPrevious">上一頁Button</param>
''' <param name="btnNext">下一頁Button</param>
''' <param name="DataTable">數據源</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Function LastPage(ByVal btnPrevious As LinkButton, ByVal btnNext As LinkButton)
Dim i_Current As Integer
Dim i_MaxPage As Integer
i_Current = _DataGrid.CurrentPageIndex
i_MaxPage = _DataGrid.PageCount - 1
If i_Current = i_MaxPage Then

_DataGrid.Page.RegisterStartupScript("GridPaginationError", "<script>alert('已到頁尾!')</script>")

Else

_DataGrid.CurrentPageIndex = i_MaxPage
_ResetDataSource.Invoke()
btnPrevious.Enabled = True
btnNext.Enabled = False
End If

End Function

''' -----------------------------------------------------------------------------
''' <summary>
''' 函數名稱: LastPage()
''' function說明:初始化頁面時Button上一頁和Button下一頁的狀態
''' </summary>
''' <param name="btnPrevious">上一頁Button</param>
''' <param name="btnNext">下一頁Button</param>
''' <param name="DataTable">數據源</param>
''' <remarks>
''' </remarks>
''' <history>
''' xx. YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
''' 1. 2006/06/05 1.00 Sunny CREATE
''' </history>
''' -----------------------------------------------------------------------------
Public Function Page_Load(ByVal btnPrevious As LinkButton, ByVal btnNext As LinkButton)

Dim i_Current As Integer
Dim i_MaxPage As Integer
Dim i_MinPage As Integer
i_Current = _DataGrid.CurrentPageIndex
i_MaxPage = _DataGrid.PageCount - 1
i_MinPage = 0

If i_Current = i_MinPage Then
btnPrevious.Enabled = False
Else
btnPrevious.Enabled = True
End If

If i_Current = i_MaxPage Then
btnNext.Enabled = False
Else
btnNext.Enabled = True
End If
End Function
#End Region

End Class

End Namespace


2006-10-24 15:55
快速回复:[求助]谁有DATAGRID分页的源代码啊.?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039824 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved