页面:
DataList省略
<webdiyer:AspNetPager ID="AspNetPager1" runat="server"
onpagechanging="AspNetPager1_PageChanging">
</webdiyer:AspNetPager>CS代码:
/// <summary>
/// 绑定产品信息
/// </summary>
private void ProductSetBind()
{
Wsb.BLL.Product bll = new Wsb.BLL.Product();
DataSet ds = new DataSet();
if (Request["IdNo"] == null)
{
ds = bll.GetList(new Guid("43FE3705-935C-4ACC-8DC1-36B7A0293D81"));//雅玉礼品
}
else
{
ds = bll.GetSubList(new Guid(Request["IdNo"].ToString()));
}
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 3; AspNetPager1.RecordCount = ds.Tables[0].DefaultView.Count;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex;
dl_DataInfo.DataSource = pds;
dl_DataInfo.DataBind();
} protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
ProductSetBind();
}总共是11条记录,每页显示3条记录,那就应该分成4页,而现在只有2页,这是怎么回事呢?
DataList省略
<webdiyer:AspNetPager ID="AspNetPager1" runat="server"
onpagechanging="AspNetPager1_PageChanging">
</webdiyer:AspNetPager>CS代码:
/// <summary>
/// 绑定产品信息
/// </summary>
private void ProductSetBind()
{
Wsb.BLL.Product bll = new Wsb.BLL.Product();
DataSet ds = new DataSet();
if (Request["IdNo"] == null)
{
ds = bll.GetList(new Guid("43FE3705-935C-4ACC-8DC1-36B7A0293D81"));//雅玉礼品
}
else
{
ds = bll.GetSubList(new Guid(Request["IdNo"].ToString()));
}
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 3; AspNetPager1.RecordCount = ds.Tables[0].DefaultView.Count;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex;
dl_DataInfo.DataSource = pds;
dl_DataInfo.DataBind();
} protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
ProductSetBind();
}总共是11条记录,每页显示3条记录,那就应该分成4页,而现在只有2页,这是怎么回事呢?
解决方案 »
- 求教!如何改变两个dropdownList之间的值??
- 在线等、急、急 求教DropDownCheckList控件怎么提取被选中的值
- [高分100]ExtExtenders.TabContainer动态生成TabPanel的问题
- window.Open('test.aspx?参数名=值','','height=250, width=400, top=0, left=0')
- 各位请进,寻帮助,急!!!
- 100分求一sql语句 急救 谢谢~~~!!!!!!!
- 如何用DateTime得到TimeStamp这样格式的日期,即有日月年,还有时间,谢谢
- 请教如何使 数据按70个字切分开来,超过70汉字就变成两条短信
- 关于datagrid
- 在ASP。NET中响应编辑框回车键是哪个消息?怎样写?
- asp.net和iis的问题
- 求一种效果的实现方法
好像不能这么写。
应该单独写个方法把数据总数读出来
你这样只是读出一也的数据
而且好像pagesize、pageindex没有传进去
你看下aspnetpager的例子吧