如何使用 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 ...
随机推荐
- 声明提前js变量
声明提前问题相关 js的变量声明语句无论出现在何处,都会先与其他代码首先被执行,使用var声明关键词声明变量的 作用于是当前的执行上下文,有可能是外围函数,或者,当变量声明在函数体之外时,则为全局变量 ...
- angular2 - content projection-
angular2中的内容映射: App.component: <my-day> <my-lucky> </my-lucky> </my-day> MyD ...
- xxxxxxx
int c; int b; bool h;
- [NOIP2015] 斗地主(搜索)
题目描述 牛牛最近迷上了一种叫斗地主的扑克游戏.斗地主是一种使用黑桃.红心.梅花.方片的A到K加上大小王的共54张牌来进行的扑克牌游戏.在斗地主中,牌的大小关系根据牌的数码表示如下:3<4< ...
- UVA 572 (dfs)
题意:找出一块地有多少油田.'@'表示油田.找到一块就全部标记. #include<cstdio> #define maxn 110 char s[maxn][maxn]; int n,m ...
- AJAX原理及应用
Ajax技术的核心是XMLHttpRequest对象(简称XHR),可以通过使用XMLHttpRequest对象获取到服务器的数据,然后再通过DOM将数据插入到页面中呈现.也就是javascript可 ...
- html/京东项目/京东网页高仿/js/jq/css/java web/
登录部分HTML+CSS: <!DOCTYPE html><html> <head> <meta charset="UTF-8& ...
- photoshop, 钢笔上色
photoshop中用 钢笔工具 勾好轮廓后,使用 路径选择工具 选中轮廓,右键弹出菜单中选 创建矢量蒙板,然后就可以在区域内用 笔刷工具 涂抹上色,不用担心出界了. ----补充2017-1-2 将 ...
- mybatis 与 xml
mybatis的两大重要组件:配置和映射文件,都是可以通过xml配置的(新版本新增了注解的方式配置Mapper),下面来解析下mybatis是怎么做的 其中,关于配置文件解析的主要是在这个类XMLCo ...
- file_get_contents()函数
$data = file_get_contents('http://www.zgjmwl.com/jinshui/pro_one/ceshi_a.php'); var_dump(substr($dat ...