ASPNETPager常用属性
来源:互联网 发布:格式工厂mac版 汉化 编辑:程序博客网 时间:2024/06/15 09:45
<
webdiyer:aspnetpager
id
=
"AspNetPager1"
runat
=
"server"
alwaysshow
=
"True"
PageSize
=
"5"
custominfosectionwidth
=
"20%"
custominfotextalign
=
"Right"
firstpagetext
=
"第一页"
horizontalalign
=
"Left"
lastpagetext
=
"末一页"
navigationbuttontype
=
"Image"
nextpagetext
=
"后一页"
pageindexboxtype
=
"TextBox"
pagingbuttonspacing
=
"8px"
prevpagetext
=
"前一页"
showcustominfosection
=
"Right"
showpageindexbox
=
"Always"
textafterpageindexbox
=
"页"
UrlPaging
=
"true"
textbeforepageindexbox
=
"跳到第"
width
=
"97%"
onpagechanged
=
"AspNetPager1_PageChanged"
>
</
webdiyer:aspnetpager
>
alwaysshow:总是显示分页控件;
PageSize:指定每页显示的记录数;
custominfosectionwidth:用户自定义信息区的宽度;
custominfotextalign:用户自定义信息区的对齐方式;
firstpagetext:第一页按钮上显示的文本;
horizontalalign:内容水平对齐方式;
lastpagetext:最后页按钮上显示的文本;
navigationbuttontype:第一页、下一页、最后一页按钮的类型;
nextpagetext:下一页按钮上显示的文本;
pageindexboxtype:指示页索引框的显示类型:有TextBOX和dropdownlist两种;
pagingbuttonspacing:导航页按钮的间距;
prevpagetext:上一页按钮的显示的文本;
showcustominfosection:显示当前页和总页信息,默认为不显示,值为LEFT时将显示在页索引前,为right时显示在页索引后;
showpageindexbox:指定页索引文本框或下拉框的显示方式;
textafterpageindexbox:指定页索引文本框或下拉框后的文本;
UrlPaging:是够使用URL传递分页的方式来分页;
textbeforepageindexbox:指定页索引文本框或下拉框前面显示的文本;
width:该控件的宽度;
CustomInfoHTML:指定要显示在用户自定义信息区的用户自定义HTML信息文本
using
System;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
using
System.Data.SqlClient;
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
Bind();
}
private
void
Bind()
{
int
pageindex = 1;
int
pagenum = AspNetPager1.PageSize;
if
(Request[
"page"
] !=
null
)
{
pageindex =Convert.ToInt32(Request[
"page"
]);
}
DataSet ds =
new
DataSet();
SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"constr"
].ToString ());
SqlConnection con1 =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"constr"
].ToString());
SqlDataAdapter sda =
new
SqlDataAdapter(
"select top (@pagenum) * from pagetest where id not in (select top (@pagenum*(@pageindex-1)) id from pagetest)"
, con);
sda.SelectCommand.Parameters.AddWithValue(
"pagenum"
,pagenum);
sda.SelectCommand.Parameters.AddWithValue(
"pageindex"
,pageindex);
sda.Fill(ds);
SqlCommand cmd =
new
SqlCommand(
"select count(*) from pagetest"
, con1);
con1.Open();
AspNetPager1.RecordCount =Convert.ToInt32(cmd.ExecuteScalar());
con.Close();
AspNetPager1.CustomInfoHTML =
"共"
+ AspNetPager1.RecordCount +
"条记录 "
+ AspNetPager1.CurrentPageIndex +
"/"
+ AspNetPager1.PageCount;
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
protected
void
AspNetPager1_PageChanged(
object
sender, EventArgs e)
{
Bind();
}
}
深入分析CurrentPageIndex、RecordCount、 PageCount、 PageSize:
pagecount:
public
int
PageCount
{
get
{
if
(
this
.RecordCount == 0)
{
return
1;
}
return
(
int
) Math.Ceiling((
double
) (((
double
)
this
.RecordCount) / ((
double
)
this
.PageSize)));
}
}
recordcount:
public
int
RecordCount
{
get
{
if
(
this
.cloneFrom !=
null
)
{
return
this
.cloneFrom.RecordCount;
}
object
obj2 =
this
.ViewState[
"Recordcount"
];
if
(obj2 !=
null
)
{
return
(
int
) obj2;
}
return
0;
}
set
{
this
.ViewState[
"Recordcount"
] = value;
}
}
CurrentPageIndex:
public
int
CurrentPageIndex
{
get
{
if
(
this
.cloneFrom !=
null
)
{
return
this
.cloneFrom.CurrentPageIndex;
}
object
obj2 =
this
.ViewState[
"CurrentPageIndex"
];
int
num = (obj2 ==
null
) ? 1 : ((
int
) obj2);
if
((num >
this
.PageCount) && (
this
.PageCount > 0))
{
return
this
.PageCount;
}
if
(num < 1)
{
return
1;
}
return
num;
}
set
{
int
pageCount = value;
if
(pageCount < 1)
{
pageCount = 1;
}
else
if
(pageCount >
this
.PageCount)
{
pageCount =
this
.PageCount;
}
this
.ViewState[
"CurrentPageIndex"
] = pageCount;
}
}
PageSize:
public
int
PageSize
{
get
{
int
num;
if
((!
string
.IsNullOrEmpty(
this
.UrlPageSizeName) && !
base
.DesignMode) && (
int
.TryParse(
this
.Page.Request.QueryString[
this
.UrlPageSizeName],
out
num) && (num > 0)))
{
return
num;
}
if
(
this
.cloneFrom !=
null
)
{
return
this
.cloneFrom.PageSize;
}
object
obj2 =
this
.ViewState[
"PageSize"
];
if
(obj2 !=
null
)
{
return
(
int
) obj2;
}
return
10;
}
set
{
this
.ViewState[
"PageSize"
] = value;
}
}
- ASPNETPager常用属性
- ASPNETPager常用属性
- AspNetPager 分页控件常用属性
- AspNetPager常用属性及一些样式
- AspNetPager属性
- AspNetPager的属性设置
- AspNetPager的一些属性
- AspNetPager
- AspNetPager
- AspNetPager
- AspNetPager
- aspnetpager
- AspNetPager
- AspNetPager
- 常用属性
- 常用属性
- Wuqi.Webdiyer.AspNetPager 比较标准的分页显示格式和属性设置
- 最常用的一种存储过程分页方式,基于AspNetPager分布控件
- STM32启动模式及IAP
- Android开源资源(开发备忘)
- Oracle分析函数总结(3)- 数值分布 - cume_dist,percent_rank,ntile,percentile_disc,percentile_cont,ratio_to_report
- myeclipse 彻底让烦人的各种验证消失 让你的开发速度飞快
- 动态table添加colspan\rowspan 参数的方法(通过Js)
- ASPNETPager常用属性
- Hadoop cluster安装部署
- 【初探移动前端开发01】惊鸿一瞥
- dcm4chee安装部署汉化
- C++内存分配方式详解——堆、栈、自由存储区、全局/静态存储区和常量存储区
- 批量查询 SQL Server 数据库大小
- 部署.net平台的程序
- UI与逻辑
- 实模式和保护模式