AspNetPager的使用
2015-06-16 21:39
645 查看
以下文章只是本人学习过程中的一个总结哈!
1 首先,我们需要将AspNetPager.dll和AspNetPager.xml这两个文件放到bin目录中。
2,在索要使用的aspx文件中添加下面这段代码
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
1 首先,我们需要将AspNetPager.dll和AspNetPager.xml这两个文件放到bin目录中。
2,在索要使用的aspx文件中添加下面这段代码
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
3,在body里面
<div style="padding-left:450px; margin-top:20px;"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" CssClass="Pages" CurrentPageButtonClass="cpb" FirstPageText="首页" HorizontalAlign="Center" LastPageText="尾页" NextPageText="后页" OnPageChanging="AspNetPager1_PageChanging" PrevPageText="前页"> </webdiyer:AspNetPager> </div>
其中相应的css
<style type="text/css"> .Pages{ color:#999;} .Pages a, .pages.cpb{ text-decoration:none; float:left; padding: 0 5px; border:1px solid #ddd; background:#ffff; margin:0 2px; font-size:11px; color:#00 0;} .Pages a:hover { background-color: #E61636; color:#fff;border:1px solid #E61636; text-decoration:none;} .Pages .cpb { font-weight: bold; color: #fff; background: #E61636; border:1px solid #E61636;} </style>
4.aspx.cs后台代码
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e) { AspNetPager1.CurrentPageIndex = e.NewPageIndex; binddata(); } public void binddata() { BLLadmin blladmin = new BLLadmin(); DataSet ds = blladmin.adminlist(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "info"); GridView1.DataSource = ds; GridView1.DataBind(); }
在这个过程中可能出现在不到命名空间,原因是UI层中没用引用bin文件夹中的AspNetPager.dll
相关文章推荐
- 分享微信开发Html5轻游戏中的几个坑
- 星外ASP.Net的安全设置相关说明
- C#、ASP.NET通用扩展工具类之TypeParse
- C#、ASP.NET通用扩展工具类之LogicSugar
- C#、ASP.NET通用工具类IsWhat?(可以判断数字、身份证、数据类型等等)
- 程序中常用的种代码
- ASP.NET、ASP、PHP、JSP之间有什么区别?
- ASP.NET页面间的传值的几种方法
- 入侵ASP.net网站的经验附利用代码
- asp.net OleDbCommand 的用法
- jquery调用asp.net 页面后台的实现代码
- asp.net中的check与uncheck关键字用法解析
- ASP.NET MVC 4 捆绑和缩小实例介绍
- ASP.Net Post方式获取数据流的一种简单写法
- asp.net动态产生checkbox(数据源为DB或内存集合)
- Asp.Net 和 AJAX.Net 的区别第1/2页
- asp.net利用后台实现直接生成html分页的方法
- asp.net用三层实现多条件检索示例
- ASP.NET Cookie 操作实现
- asp.net SqlDataAdapter对象使用札记