| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1283 人关注过本帖
标题:大家这里都没谈 asp.net分页问题
只看楼主 加入收藏
accpfriend
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:167
专家分:102
注 册:2006-12-31
结帖率:0
收藏
 问题点数:0 回复次数:12 
大家这里都没谈 asp.net分页问题
图片附件: 游客没有浏览图片的权限,请 登录注册


想问问大家这样的asp.net的分页谁做过,

有源代码最好共享一下,

再说是大家也谈谈asp.net中分页问题

如过千的数据给你, 你如何做到有效的分页,而且是通用的.
搜索更多相关主题的帖子: 页问题 源代码 asp 中分 数据 
2006-12-31 10:17
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 

用个GirdView不是就很简单吗?


飘过~~
2006-12-31 14:27
accpfriend
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:167
专家分:102
注 册:2006-12-31
收藏
得分:0 
GridView那个不能用于大量的数据,
GridView那个不能用于大量的数据,
2006-12-31 14:36
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
以下是引用bygg在2006-12-31 14:27:24的发言:

用个GirdView不是就很简单吗?

GirdView太傻瓜了
做不出来多样式的分页。。
我不喜欢在前台用。。


2006-12-31 14:39
YSKING
Rank: 5Rank: 5
来 自:中国绿城
等 级:贵宾
威 望:16
帖 子:1380
专家分:25
注 册:2006-11-11
收藏
得分:0 
以下是引用rainic在2006-12-31 14:39:16的发言:

GirdView太傻瓜了
做不出来多样式的分页。。
我不喜欢在前台用。。

愿闻其详

[此贴子已经被作者于2006-12-31 17:06:23编辑过]


仍然自由自我,永远高唱我歌,走遍千里...
2006-12-31 16:02
xiaochun662003
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2006-7-8
收藏
得分:0 

这个datatable最减少系统资源.只返回当前页的数据。

Public Function ExecuteDataTableCommonProc(ByVal tablename As String, ByVal fields As String, ByVal condition As String, ByVal pagesize As Integer, ByVal currentpage As Integer, ByVal orderfield As String, ByVal ordertype As String) As DataTable
Dim textArray1 As String()
Dim text1 As String = ""
If (ordertype Is "Desc") Then
If (condition Is "None") Then
If (currentpage = 1) Then
text1 = String.Concat(New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " Order By ", orderfield, " Desc" })
Else
textArray1 = New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " Where ", orderfield, "<(Select Min(", orderfield, ") From (Select Top ", (pagesize * (currentpage - 1)).ToString, " ", orderfield, " From ", tablename, " Order By ", orderfield, " Desc) Temp) Order By ", orderfield, " Desc" }
text1 = String.Concat(textArray1)
End If
ElseIf (currentpage = 1) Then
text1 = String.Concat(New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " ", condition, " Order By ", orderfield, " Desc" })
Else
textArray1 = New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " ", condition, " And ", orderfield, "<(Select Min(", orderfield, ") From (Select Top ", (pagesize * (currentpage - 1)).ToString, " ", orderfield, " From ", tablename, " ", condition, " Order By ", orderfield, " Desc) Temp) Order By ", orderfield, " Desc" }
text1 = String.Concat(textArray1)
End If
ElseIf (condition Is "None") Then
If (currentpage = 1) Then
text1 = String.Concat(New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " Order By ", orderfield, " Asc" })
Else
textArray1 = New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " Where ", orderfield, ">(Select Max(", orderfield, ") From (Select Top ", (pagesize * (currentpage - 1)).ToString, " ", orderfield, " From ", tablename, " Order By ", orderfield, " Asc) Temp) Order By ", orderfield, " Asc" }
text1 = String.Concat(textArray1)
End If
ElseIf (currentpage = 1) Then
text1 = String.Concat(New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " ", condition, " Order By ", orderfield, " Asc" })
Else
textArray1 = New String() { "Select Top ", pagesize.ToString, " ", fields, " From ", tablename, " ", condition, " And ", orderfield, ">(Select Max(", orderfield, ") From (Select Top ", (pagesize * (currentpage - 1)).ToString, " ", orderfield, " From ", tablename, " ", condition, " Order By ", orderfield, " Asc) Temp) Order By ", orderfield, " Asc" }
text1 = String.Concat(textArray1)
End If
Return Me.ExecuteDataTable(text1)
End Function

2007-02-02 15:44
xiaochun662003
Rank: 1
等 级:新手上路
帖 子:42
专家分:0
注 册:2006-7-8
收藏
得分:0 

生成分页导航

Public Shared Function GetPage(ByVal QueryString As String, ByVal Count As Integer, ByVal PageSize As Integer, ByVal CurrentPage As Integer, ByVal SizePerPage As Integer, ByVal StylePath As String) As String
Dim num1 As Integer
Dim num2 As Integer
If ((Count Mod PageSize) = 0) Then
num2 = Convert.ToInt32(CInt((Count / PageSize)))
Else
num2 = (Convert.ToInt32(CInt((Count / PageSize))) + 1)
End If
If (Not QueryString.Trim Is String.Empty) Then
QueryString = (QueryString & "&")
End If
If (num2 <= 0) Then
num2 = 1
End If
If (CurrentPage > num2) Then
CurrentPage = num2
End If
Dim builder1 As New StringBuilder
builder1.Append("<table class=Pager_Table cellspacing=1 cellpadding=0><tr>")
builder1.Append(String.Concat(New String() { "<td class=Pager_ColorTD>", Count.ToString, "</td><td class=Pager_ColorTD>", CurrentPage.ToString, "/", num2.ToString, "</td>" }))
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=1><img src=", StylePath, "/dot_left-01.gif alt=" & ChrW(39318) & ChrW(39029) & " border=0/></a></td>" }))
If (num2 > SizePerPage) Then
Dim textArray1 As String()
If (CurrentPage > (SizePerPage / 2)) Then
If (CurrentPage > (num2 - (SizePerPage / 2))) Then
textArray1 = New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", (CurrentPage - SizePerPage).ToString, "><img src=", StylePath, "/dot_left.gif alt=" & ChrW(19978) & "10" & ChrW(39029) & " border=0/></a></td>" }
builder1.Append(String.Concat(textArray1))
num1 = (num2 - SizePerPage)
Do While (num1 <= num2)
If (num1 = CurrentPage) Then
builder1.Append(("<td class=Pager_TD><a href=# class=Red_Link>" & num1.ToString & "</a></td>"))
Else
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", num1.ToString, ">", num1.ToString, "</a></td>" }))
End If
num1 += 1
Loop
Else
textArray1 = New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", (CurrentPage - SizePerPage).ToString, "><img src=", StylePath, "/dot_left.gif alt=" & ChrW(19978) & "10" & ChrW(39029) & " border=0/></a></td>" }
builder1.Append(String.Concat(textArray1))
num1 = (CurrentPage - (SizePerPage / 2))
Do While (num1 <= (CurrentPage + (SizePerPage / 2)))
If (num1 = CurrentPage) Then
builder1.Append(("<td class=Pager_TD><a href=# class=Red_Link>" & num1.ToString & "</a></td>"))
Else
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", num1.ToString, ">", num1.ToString, "</a></td>" }))
End If
num1 += 1
Loop
textArray1 = New String(7 - 1) {}
textArray1(0) = "<td class=Pager_TD><a href=?"
textArray1(1) = QueryString
textArray1(2) = "Page="
textArray1(3) = (CurrentPage + SizePerPage).ToString
textArray1(4) = "><img src="
textArray1(5) = StylePath
textArray1(6) = "/dot_right.gif alt=" & ChrW(19979) & "10" & ChrW(39029) & " border=0/></a></td>"
builder1.Append(String.Concat(textArray1))
End If
Else
num1 = 1
Do While (num1 <= SizePerPage)
If (num1 = CurrentPage) Then
builder1.Append(("<td class=Pager_TD><a href=# class=Red_Link>" & num1.ToString & "</a></td>"))
Else
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", num1.ToString, ">", num1.ToString, "</a></td>" }))
End If
num1 += 1
Loop
textArray1 = New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", (CurrentPage + SizePerPage).ToString, "><img src=", StylePath, "/dot_right.gif alt=" & ChrW(19979) & "10" & ChrW(39029) & " border=0/></a></td>" }
builder1.Append(String.Concat(textArray1))
End If
Else
num1 = 1
Do While (num1 <= num2)
If (num1 = CurrentPage) Then
builder1.Append(("<td class=Pager_TD><a href=# class=Red_Link>" & num1.ToString & "</a></td>"))
Else
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", num1.ToString, ">", num1.ToString, "</a></td>" }))
End If
num1 += 1
Loop
End If
builder1.Append(String.Concat(New String() { "<td class=Pager_TD><a href=?", QueryString, "Page=", num2.ToString, "><img src=", StylePath, "/dot_right-01.gif alt=" & ChrW(23614) & ChrW(39029) & " border=0/></a></td></tr></table>" }))
Return builder1.ToString
End Function


2007-02-02 15:46
hoya
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:538
专家分:0
注 册:2006-6-27
收藏
得分:0 
不想这么麻烦就网上搞个.--aspnetpage

妈的...一天能卖一颗就很不错了...
2007-02-03 09:34
dawei322
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2006-10-25
收藏
得分:0 
偶曰:"6楼的你敢去vb.net版块发你那东西么??"
又曰:"7楼的你敢写C#语言的代码么??"
2007-02-04 10:38
lhq22
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2007-4-27
收藏
得分:0 
我想要完整的分页显示数据记录的分页源码!!那位大虾可以献出一份给我!!

2007-06-02 21:51
快速回复:大家这里都没谈 asp.net分页问题
数据加载中...
 
   



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

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