如何使用 aspnetpager
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <webdiyer:AspNetPager id="AspNetPager1" runat="server" ShowPageIndexBox="Always"
PageSize="20" OnPageChanged="AspNetPager1_PageChanged"
TextBeforeInputBox="转到第 "
TextAfterInputBox=" 页 " ShowPageIndex="False"
ShowInputBox="Always"
ShowCustomInfoSection="Left" PrevPageText="上一页"
NextPageText="下一页" LastPageText="尾页"
FirstPageText="首页" AlwaysShow="True"
CustomInfoSectionWidth="600"
CustomInfoTextAlign="NotSet" LayoutType="Table">
</webdiyer:AspNetPager> <webdiyer:AspNetPager ID="AspNetPager2" runat="server" CloneFrom="AspNetPager1">
</webdiyer:AspNetPager>
public void checkCase()
{
string strSql = " ID>0";
int num = bll.GetRecordCount(strSql);
AspNetPager1.RecordCount = num;
DataSet ds = bll.GetAspNetPagerDataSet(strSql, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize);
if (ds.Tables[].Rows.Count > )
{
this.Repeater1.DataSource = ds.Tables[].DefaultView;
this.Repeater1.DataBind(); AspNetPager1.CustomInfoHTML = "共:<font color=\"red\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font> 条记录";
AspNetPager1.CustomInfoHTML += " 总页数:<font color=\"red\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font> 页";
AspNetPager1.CustomInfoHTML += " 每页显示:<font color=\"red\"><b>" + AspNetPager1.PageSize.ToString() + "</b></font> 条";
AspNetPager1.CustomInfoHTML += " 当前页:<font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font> ";
}
}
bll
/// <summary>
/// 获得aspnetpager分页数据
/// </summary>
public DataSet GetAspNetPagerDataSet(string whereSql, int mypageindex, int mypagesize)
{
return dal.GetAspNetPagerList(whereSql, mypageindex, mypagesize);
}
DAL
/// <summary>
/// 获得AspNetPager分页数据列表
/// </summary>
public DataSet GetAspNetPagerList(string strWhere, int mypageindex, int mypagesize)
{
StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT ID,sTitle,sContent,sAuthor,sAuthorTel,sAuthorQQ,sAuthorEmail,toDepart,ifPass,PubDate ");
strSql.Append(" FROM QuestionBook ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
strSql.Append(" order by ID desc");
return SQLHelper.ExecuteWebDiyerDataset(SQLHelper.DBCONNECTIONSTRING, CommandType.Text, strSql.ToString(), mypageindex, mypagesize);
}
DBTtility
#region 为webdiyer分页控件做的 DataSet 传递参数进来 DataSet ExecuteWebDiyerDataset(string connString, CommandType cmdType, string cmdText,int mypageindex,int mypagesize, params SqlParameter[] cmdParms)
public static DataSet ExecuteWebDiyerDataset(string connString, CommandType cmdType, string cmdText, int mypageindex, int mypagesize, params SqlParameter[] cmdParms)
{
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = new SqlCommand(); using (SqlConnection conn = new SqlConnection(connString))
{
PrepareCommand(myAdapter.SelectCommand, conn, null, cmdType, cmdText, cmdParms);
DataSet ds = new DataSet();
myAdapter.Fill(ds, mypagesize * (mypageindex - ), mypagesize, "dtable");
myAdapter.SelectCommand.Parameters.Clear();
return ds; } }
#endregion
如何使用 aspnetpager的更多相关文章
- AspNetPager分页控件样式的使用
分页是Web应用程序中最常用到的功能之一,AspNetPager 简单实用,应用到项目后台中,棒极了! 自定义样式: <style type="text/css"> ...
- AspNetPager 多条件分页查询
AspNetPager 这个分页控件一般做后台基本都知道的,我就不多说了(说明与下载链接:http://www.webdiyer.com/Controls/AspNetPager),嘿嘿!其实我也是刚 ...
- AspNetPager分页控件的使用
下面所记得东西仅仅是使用方法,详细知识点请看链接:http://www.webdiyer.com/Controls/AspNetPager/Downloads 首先:从网站上下载并安装控件 下载地址: ...
- AspNetPager分页控件配置
AspNetPager是asp.net中常用的分页控件,下载AspNetPager.dll,添加引用,在工具栏就可以看到AspNetPager控件: 拖过来之后,设置如下属性: <webdiye ...
- 修改AspNetPager的CustomInfoHTML,添加自定义样式
AspNetPager控件有一个属性叫CustomInfoHTML,可以把它写在前台页面,如下: <webdiyer:AspNetPager ID=" HorizontalAlign= ...
- AspNetPager控件分页使用方法
AspNetPager控件官方下载地址:http://www.webdiyer.com/aspnetpager/ 把控件加到项目中(添加自定义控件的方法),并把它拖放到页面上 <asp:Scri ...
- 未能加载文件或程序集“AspNetPager”或它的某一个依赖项。参数错误(转)
未能加载文件或程序集“AspNetPager”或它的某一个依赖项.参数错误. 看你的的开发框架用的是多少的2.0, 3.0, 3.5, 4.0 那么删除的框架的文件夹也相对应的变化 删除 C:\W ...
- AspNetPager控件报错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$Aspnetpager1_input问题解决[摘]
高版本IE,如IE10或者IE11在浏览页面时出现错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$ ...
- AspNetPager分页控件
AspNetPager分页控件解决了分页中的很多问题,直接采用该控件进行分页处理,会将繁琐的分页工作变得简单化,下面是我如何使用AspNetPager控件进行分页处理的详细代码:1.首先到www.we ...
随机推荐
- java内存图解
最近突然对java的内存管理来了兴趣想,之前对java内存很模糊,通过这几天的学习现在将学习成果记录下来欢迎大家多多指教,为了方便我自己画了一个图
- 【转】mysql忘记密码(未初始化)
Mac OS X - 重置 MySQL Root 密码您是否忘记了Mac OS 的MySQL的root密码? 通过以下4步就可重新设置新密码:1. 停止 mysql server. 通常是在 '系 ...
- 网页中插入视频(object)
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://down ...
- System.DateUtils 3. IsPM、IsAM 判断是否为上、下午
编译版本:Delphi XE7 function IsPM(const AValue: TDateTime): Boolean; inline;function IsAM(const AValue: ...
- 排序算法练习--JAVA(插入、直接选择、冒泡、快速排序、非递归快速排序)
排序算法是数据结构中的经典算法知识点,也是笔试面试中经常考察的问题,平常学的不扎实笔试时候容易出洋相,回来恶补,尤其是碰到递归很可能被问到怎么用非递归实现... package sort; impor ...
- HTML5画布实现方法:
我们可以在HTML中使用属性width和height来定义Canvas.但是实现Canvas的相关功能主要还依赖于Javascript实现,即HTML5 Canvas API.我们使用javascri ...
- 1月12日,HTML学习笔记2
妈蛋,这两天看HTML看上瘾了,感觉这玩意有点简单,反馈期太短了,我的python都荒废了/(ㄒoㄒ)/~~. 不多说了,把记录贴上来,到时过几天再拿出来整理一下,写上注释,顺便当做复习 去研究css ...
- maven-deploy失败
昨天遇到的问题,mavne项目执行deploy的时候,出错.提示 Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1] 很直白 ...
- uml和模式01
// */ // ]]> uml和模式01 1. UML 2. 用例图 3. 用例和类的关系 4. 类图 1 UML 模型语言(Modeling Language 检查ML)是一种设计语言,人们 ...
- Mysql大范围分页优化案例
在BBS线上业务抓到如下分页SQL: meizu_bbs meizu_bbs Query Sending data , meizu_bbs meizu_bbs Query Sending data , ...