首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

AspNetPager 分不了页 大侠们帮小弟我解决啊多谢

2012-05-31 
AspNetPager分不了页大侠们帮我解决啊!!!谢谢HTMLasp:UpdatePanel IDUpdatePanel1 runatserverCo

AspNetPager 分不了页 大侠们帮我解决啊!!!谢谢
HTML  
  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
  <div class="pro-text">
  <div class="pro-cx">
  <uc1:Search ID="Search1" runat="server" />
  </div>
  <div class="pro-table">
  <asp:Repeater ID="reptList1" runat="server">
  <HeaderTemplate>
  <table width="975" border="0" cellspacing="0" cellpadding="0" class="dyent">
  <tr>
  <th>
  序号
  </th>
  <th>
  原料
  </th>
  <th>
  纱支
  </th>
  <th>
  密度
  </th>
  <th>
  幅宽
  </th>
  <th>
  布边
  </th>
  <th>
  品名
  </th>
  <th>
  标准
  </th>
  <th>
  质量简单说明
  </th>
  <th>
  参考报价
  </th>
  <th>
  报价日期
  </th>
  </tr>
  </HeaderTemplate>
  <ItemTemplate>
  <tr>
  <td>
  <a href="#">
  <%#Eval("p_List_Number")%></a>
  </td>


  <td>
  <%#Eval("p_List_Yl")%>
  </td>
  <td>
  <%#Eval("p_List_Sz")%>
  </td>
  <td>
  <%#Eval("p_List_Md")%>
  </td>
  <td>
  <%#Eval("p_List_Fk")%>
  </td>
  <td>
  <%#Eval("p_List_Bb")%>
  </td>
  <td>
  <%#Eval("p_List_Pm")%>
  </td>
  <td>
  <a href="#">
  <%#Eval("p_List_Zlbz")%></a>
  </td>
  <td>
  <%#Eval("p_List_Zljdsm")%>
  </td>
  <td>
  <%#Eval("p_List_Xxjg")%>
  </td>
  <td>
  <%#Eval("p_List_Creater","{0:MM-dd}")%>
  </td>
  </tr>
  </ItemTemplate>
  <FooterTemplate>
  </table>
  </FooterTemplate>
  </asp:Repeater>
  </div>
  </div>
  </div>
  <div class="shouye_fy">
  <webdiyer:AspNetPager ID="anp7" runat="server" PageSize="2" ShowPageIndexBox="Auto"
  onpagechanging="anp7_PageChanging" FirstPageText="首页" LastPageText="最后一页" NextPageText="下页"
  PrevPageText="上页">
  </webdiyer:AspNetPager>
  </div>
  </ContentTemplate>
  </asp:UpdatePanel>


CS代码:
  void getcmpb()
  {
   
  DataSet ds = new DataSet();
  p_ListDAL dal = new p_ListDAL();


  ds = dal.getDYxh("0","0");

  DataView dv = ds.Tables[0].DefaultView;
  anp7.RecordCount = dv.Count;
  if(dv.Count >0)
  {
  PagedDataSource pds = new PagedDataSource();
  pds.DataSource = dv;
  pds.AllowCustomPaging = true;
  pds.CurrentPageIndex = anp7.CurrentPageIndex - 1;
  pds.PageSize = anp7.PageSize;
  reptList1.DataSource = pds;
  reptList1.DataBind();
   
   
  }

   
  }
  protected void anp7_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  {

   

  anp7.CurrentPageIndex = e.NewPageIndex;
  getcmpb();
  }


在线等 qq 99265117

[解决办法]
public void fenye()
{
PagedDataSource pds = new PagedDataSource();

pds.AllowPaging = true;
pds.CurrentPageIndex =this.CurrentPageIndex;
pds.DataSource = ArticleManager.GetAllArticle();
pds.PageSize = 2;


this.CountPage= pds.PageCount;
lblFy.Text = "第" + pds.CurrentPageIndex + "页,共" + this.CountPage + "页";
DataList1.DataSource = pds;
DataList1.DataBind();
}








protected void btnPes_Click(object sender, EventArgs e)
{
this.CurrentPageIndex--;


}
protected void btnNext_Click(object sender, EventArgs e)
{
this.CurrentPageIndex++;

}
试一下这个

热点排行
Bad Request.