JavaShuo
栏目
标签
AspnetPage分页控件
时间 2019-11-09
标签
aspnetpage
分页
控件
繁體版
原文
原文链接
AspNetPager分页控件
html
AspNetPager分页控件解决了分页中的不少问题,直接采用该控件进行分页处理,会将繁琐的分页工做变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码: 1.首先到
www.webdiyer.com
下载最新的AspNetPager.dll,直接在vs2005中添加引用便可。 2.在页面上注册控件,引入该控件,固然,须要在页面中使用一个数据载体,我这里使用的是repeater控件。
<%
@ Register Assembly
=
"
AspNetPager
"
Namespace
=
"
Wuqi.Webdiyer
"
TagPrefix
=
"
webdiyer
"
%>
<!--
省略
-->
<
Webdiyer:AspNetPager
id
="AspNetPager1"
runat
="server"
HorizontalAlign
="Right"
FirstPageText
="<<"
LastPageText
=">>"
PrevPageText
="<"
NextPageText
=">"
NumericButtonTextFormatString
="-{0}-"
Width
="600px"
ShowCustomInfoSection
="Left"
ShowBoxThreshold
="2"
PageSize
="5"
InputBoxClass
="text2"
TextAfterInputBox
=""
OnPageChanging
="AspNetPager1_PageChanging"
/>
3.cs代码
DataSet ds; SqlDataAdapter dr; SqlCommand com;
protected
void
Page_Load(
object
sender, EventArgs e) {
if
(
!
IsPostBack) {
string
strconn
=
System.Configuration.ConfigurationManager.ConnectionStrings[
"
SperConnectionString1
"
].ToString(); SqlConnection con
=
new
SqlConnection(strconn); con.Open(); com
=
new
SqlCommand(); com.Connection
=
con; com.CommandText
=
"
select count(*) from Article
"
; AspNetPager1.AlwaysShow
=
true
; AspNetPager1.PageSize
=
5
; AspNetPager1.RecordCount
=
(
int
)com.ExecuteScalar(); con.Close(); RepeaterDataBind(); } }
private
void
RepeaterDataBind() {
string
strconn
=
System.Configuration.ConfigurationManager.ConnectionStrings[
"
SperConnectionString1
"
].ToString(); dr
=
new
SqlDataAdapter(
"
select * from Article
"
, strconn); ds
=
new
DataSet(); dr.Fill(ds, AspNetPager1.PageSize
*
(AspNetPager1.CurrentPageIndex
-
1
), AspNetPager1.PageSize,
"
Article
"
);
this
.Repeater2.DataSource
=
ds.Tables[
"
Article
"
];
this
.Repeater2.DataBind();
}
protected
void
AspNetPager1_PageChanging(
object
src, Wuqi.Webdiyer.PageChangingEventArgs e) { AspNetPager1.CurrentPageIndex
=
e.NewPageIndex; RepeaterDataBind(); }
protected
string
FormatString_Size_13(
string
str) {
if
(str.Length
>
33
) { str
=
str.Substring(
0
,
32
)
+
"
"
; }
return
str; }
4.最后修改AspNetPager控件的PageChanging事件为AspNetPager1_PageChanging就能够了。
相关文章
1.
MVC分页控件
2.
Wpf分页控件
3.
C# 分页控件
4.
yii CLinkPager 分页控件
5.
WPF里DataGrid分页控件
6.
WPF实现分页控件
7.
Extjs Ext.form.ComboBox() 控件分页
8.
wpf制做分页控件
9.
简单分页控件
10.
利用AspNetpager控件分页
更多相关文章...
•
ASP.NET HtmlAnchor 控件
-
ASP.NET 教程
•
ASP.NET HtmlButton 控件
-
ASP.NET 教程
•
Git五分钟教程
•
算法总结-二分查找法
相关标签/搜索
aspnetpage
控件
分页
日期控件
Android - 控件
设置分页
分页功能
自定义控件
MySQL教程
SQLite教程
Spring教程
插件
文件系统
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
python的安装和Hello,World编写
2.
重磅解读:K8s Cluster Autoscaler模块及对应华为云插件Deep Dive
3.
鸿蒙学习笔记2(永不断更)
4.
static关键字 和构造代码块
5.
JVM笔记
6.
无法启动 C/C++ 语言服务器。IntelliSense 功能将被禁用。错误: Missing binary at c:\Users\MSI-NB\.vscode\extensions\ms-vsc
7.
【Hive】Hive返回码状态含义
8.
Java树形结构递归(以时间换空间)和非递归(以空间换时间)
9.
数据预处理---缺失值
10.
都要2021年了,现代C++有什么值得我们学习的?
本站公众号
欢迎关注本站公众号,获取更多信息
相关文章
1.
MVC分页控件
2.
Wpf分页控件
3.
C# 分页控件
4.
yii CLinkPager 分页控件
5.
WPF里DataGrid分页控件
6.
WPF实现分页控件
7.
Extjs Ext.form.ComboBox() 控件分页
8.
wpf制做分页控件
9.
简单分页控件
10.
利用AspNetpager控件分页
>>更多相关文章<<