返回> 网站首页 

[转载]AspNetPager分页控件

yoours2014-04-23 11:13:11 阅读 1669

简介一边听听音乐,一边写写文章。

 CSS Code 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.paginator {
font:12px Arial, Helvetica, sans-serif;
margin:0;
padding:10px 20px 10px 0;
}

.paginator a {
background:#fff;
margin-right:2px;
border:solid 1px #ccc;
color:#0063dc;
cursor:pointer;
text-decoration:none;
padding:1px 6px;
}

.paginator a:visited {
border:solid 1px #ddd;
background:#fff;
text-decoration:none;
padding:1px 6px;
}

.paginator .cpb {
font-size:13px;
border:1px solid #F50;
font-weight:700;
color:#F50;
background-color:#ffeee5;
padding:1px 6px;
}

.paginator a:hover {
background:#ffa501;
border:solid 1px #F50;
color:#f60;
text-decoration:none;
border-color:#ffa501;
}

.pages {
font:12px Arial, Helvetica, sans-serif;
margin-left:10px;
padding:5px 20px 5px 0;
}

.pages a,.pages .cpb {
text-decoration:none;
float:left;
border:1px solid #ddd;
background:#ffff;
font-size:11px;
color:#000;
margin:0 2px;
padding:0 5px;
}

.pages a:hover {
background-color:#E61636;
color:#fff;
border:1px solid #E61636;
text-decoration:none;
}

.pages .cpb {
font-weight:700;
color:#fff;
background:#E61636;
border:1px solid #E61636;
}

.paginator a,.paginator a:visited,.paginator .cpb,.paginator a:hover {
float:left;
height:16px;
line-height:16px;
min-width:10px;
_width:10px;
margin-right:5px;
text-align:center;
white-space:nowrap;
font-size:12px;
font-family:Arial,SimSun;
padding:0 3px;
}
 
 HTML Code 
1
2
3
4
5
6
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" 
    CssClass="paginator" CurrentPageButtonClass="cpb" Direction="LeftToRight" 
    FirstPageText="首页" LastPageText="尾页" LayoutType="Table" NextPageText="下一页" 
    onpagechanging="AspNetPager1_PageChanging" PageSize="10" PrevPageText="上一页" 
    ShowCustomInfoSection="Left" ShowInputBox="Never" Width="100%">
</webdiyer:AspNetPager>
 C# Code 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DataTable dt = NewService.FindBySort();
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
AspNetPager1.RecordCount = dt.Rows.Count;
Repeater1.DataSource = pds;
Repeater1.DataBind();
this.AspNetPager1.CustomInfoHTML = string.Format("当前第{0}/{1}页 共{2}条记录 每页{3}条"new object[]
{
    AspNetPager1.CurrentPageIndex,
    AspNetPager1.PageCount,
    AspNetPager1.RecordCount,
    AspNetPager1.PageSize
});
微信小程序扫码登陆

文章评论

1669人参与,0条评论