在网上找了半天,但都太强大看不懂,只能自己研究了,终于写出来了,哎 方法如下: /// <summary> /// DataTable数据分页 /// </summary> /// <param name="dt">DataTable</param> /// <param name="pindex">当前页</param> /// <param name="size">每页显示数</param> /// <param name="tpage">总页数</param> /// <returns>当前页</returns> public Int32 Pager(DataTable dt,Int32 pindex, Int32 size,Int32 tpage) { if (pindex < 0) return 0; if (pindex >= tpage) return tpage - 1; int p = pindex; int Pagesize=size; if (p == tpage - 1) Pagesize = dt.Rows.Count - ((tpage - 1) * size); foreach (DataColumn Col in dt.Columns) Console.Write("{0,10}/t", Col); Console.WriteLine(); int k =0; for (int i = p * Pagesize; i < (p + 1) * Pagesize; i++) { for (int j = 0; j < dt.Columns.Count; j++) { Console.Write("{0,10}/t", dt.Rows[Pagesize == size ? i : dt.Rows.Count < Pagesize ? i = 0 :(p<=1?1:p)*size+k] [j]); } Console.WriteLine(); k++; } return p; } 前台调用: //这里把方法放到了Ucontroller Ucontroller.Page = Ucontroller.Pager(dt, Ucontroller.Page, Ucontroller.Pagesize, Ucontroller.PageCount);