没有合适的资源?快使用搜索试试~ 我知道了~
.NET实现Repeater控件+AspNetPager控件分页
3 下载量 147 浏览量
2020-10-23
06:55:55
上传
评论
收藏 70KB PDF 举报
温馨提示
试读
3页
本文给大家分享的2个示例,演示AspNetPager最基本的功能,帮助您认识AspNetPager分页控件及了解它的工作原理。有需要的小伙伴可以参考下
资源推荐
资源详情
资源评论
.NET实现实现Repeater控件控件+AspNetPager控件分页控件分页
本文给大家分享的2个示例,演示AspNetPager最基本的功能,帮助您认识AspNetPager分页控件及了解它的工作原理。有需要的小伙伴可以参考下
当然首先你要把bin文件放进你的项目,并加到你的工具栏去
//页头需引用的
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
控件部分(格式已经设计好)
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" FirstPageText="<font face='Webdings'>9</font>"
LastPageText="<font face='Webdings'>:</font>" NextPageText="<font face='Webdings'>8</font>"
PrevPageText="<font face='Webdings'>7</font>" ShowCustomInfoSection="Left" InputBoxStyle="width:19px"
TextAfterInputBox="页" TextBeforeInputBox="转到第" CustomInfoHTML="共检索到<strong>%RecordCount%</strong>条记录 页次:<strong>%CurrentPageIndex%/%PageCount%</strong> 每页<strong>%PageSize%</strong>条"
HorizontalAlign="Right" Width="100%" ShowInputBox="Always" OnPageChanged="AspNetPager1_PageChanged"
PageSize="20" ShowBoxThreshold="1">
</webdiyer:AspNetPager>
后台绑定的代码
void databind()
{
int QYId = Convert.ToInt32(Request.Cookies["CompenyUser"].Value);//企业的Id
DataTable dt = bll.Viewlist(QYId);
this.AspNetPager1.RecordCount = dt.Rows.Count;//获取数据的总数
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dt.DefaultView;//为控件绑定数据
pds.AllowPaging = true;//分页启用
pds.PageSize = AspNetPager1.PageSize;//获取每页显示的数量
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
Repeater1.DataSource = pds;
Repeater1.DataBind();
}
分页,只需要把绑定放在AspNetPager1_PageChanged 事件里
再给大家一个实例
前台页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TF_Product.aspx.cs" Inherits="TF_Product" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>通服产品</title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked
$("#firstpane p.menu_head").click(function()
{
$(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
$(this).siblings().css({backgroundImage:"url(left.png)"});
});
});
</script>
<style type="text/css">
.menu_list { width: 229px; font-size:13px; }
.menu_head { padding: 8px 60px; cursor: pointer; position: relative; margin:1px; height:16px; background: #DFEDFA url(left.png) center right no-repeat; }
.menu_body { display:none;}
.menu_body a { display:block; color:#006699; background-color:#EFEFEF; padding-left:60px; padding-top:8px; padding-bottom:3px; text-decoration:none; }
.menu_body a:hover { color: #000000; text-decoration:underline; }
</style>
<meta name="keywords" content="通服科技">
<meta name="description" content="江西通服科技有限公司">
<link href="./Index_files/style.css" type="text/css" rel="stylesheet">
<script src="js/AC_RunActiveContent.js" type="text/javascript"></script>
<!--焦点图-->
<style type="text/css">
.anpager{background:#DFEDFA none repeat scroll 0 0;border:1px solid #CCCCCC;color:#FFFFFF;padding:4px 5px 4px 5px;}
.container, .container *{margin:0; padding:0;}
.container{width:886px; height:267px; overflow:hidden;position:relative;}
.slider{position:absolute;}
.slider li{ list-style:none;display:inline;}
.slider img{ width:886px; height:267px; display:block;}
.num{ position:absolute; right:5px; bottom:5px;}
.num li{
float: left;
color: #FF7300;
text-align: center;
line-height: 16px;
width: 16px;
height: 16px;
font-family: Arial;
font-size: 12px;
cursor: pointer;
overflow: hidden;
margin: 3px 1px;
border: 1px solid #FF7300;
background-color: #fff;
}
.num li.on{
color: #fff;
line-height: 21px;
width: 21px;
height: 21px;
font-size: 16px;
margin: 0 1px;
border: 0;
background-color: #FF7300;
font-weight: bold;
}
</style>
<!--焦点图-->
</head>
资源评论
weixin_38684743
- 粉丝: 6
- 资源: 960
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 求第n项fib数,c语言
- 递归求fabonacci数列.docx
- 递归求fabonacci数列.docx
- linphone-git-src-2025-05-09 4/5 (linphone-src-20240509.7z.003)
- 智能家居(smarthome)调试代码(未完全)
- 人脸识别的介绍.docx
- linphone-git-src-2025-05-09 3/5(linphone-sr....20240509.7z.002)
- img-17152982901318ac966474d0acea9bd1f42d490159bdf6fd524196ad400ded899531bec58eaf8.jpg
- 人脸识别的介绍.docx
- stm32-f407-lcd-ft6336-proj
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功