正在阅读:Eric的超高效数据分页(图示+代码)Eric的超高效数据分页(图示+代码)

2004-09-13 14:41 出处:CSDN 作者:ericfine 责任编辑:linjixiong

  

 n++;
  }

  dr.Close();
  conn.Close();
  sb.Remove(sb.Length - 1, 1);
  idsStrArray = sb.ToString().Split('#');
  Session["idStr"] = sb.ToString();
  }

  hidPageCount.Value = idsStrArray.Length.ToString();
  sqlStr = "SELECT megaid, megaguid FROM megatable WHERE megaid IN (" + idsStrArray[selectedPage - 1] + ") ";
  sqlStr += "ORDER BY megaguid";
  return sqlStr;
  }
  
  Panel getPager(int firstPage)
  {
  int pageCount = int.Parse(hidPageCount.Value);
  Panel pnlPager = new Panel();
  pnlPager.Controls.Add(new LiteralControl("<BR> 共" + pageCount.ToString() + "页 "));
  pnlPager.Controls.Add(getLinkButton("Fst", "首页", "pgBtn", "1"));
  pnlPager.Controls.Add(new LiteralControl(" "));

  if (firstPage > 0)
  {
  pnlPager.Controls.Add(getLinkButton("Pre", "前" + pages.ToString() + "页", "pgBtn", (firstPage - pages + 1).ToString()));
  pnlPager.Controls.Add(new LiteralControl(" "));
  }

  for (int i = firstPage + 1; i < firstPage + pages + 1; i++)
  {
  if (i > pageCount)
  {
  break;
  }
  
  pnlPager.Controls.Add(getLinkButton(i.ToString(), "[" + i.ToString() + "]", "pgBtn", i.ToString()));
  pnlPager.Controls.Add(new LiteralControl(" "));
  }

  if (firstPage + pages < pageCount)
  {
  pnlPager.Controls.Add(getLinkButton("Nxt", "后" + pages.ToString() + "页", "pgBtn", (firstPage + pages + 1).ToString()));
  pnlPager.Controls.Add(new LiteralControl(" "));
  }

 

 


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品