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(" ")); } |