public static string GetPaperHtml(int RecordCount, int PageIndex, int PageSize, string FunName, string FunParams)
{
StringBuilder sb = new StringBuilder();
//页数
int PageCount = RecordCount / PageSize;
if (RecordCount % PageSize > 0)
{
PageCount++;
}
//页码显示
if (PageCount > 1)
{
sb.Append("<div class=\"gkPage\">");
sb.AppendFormat("总条数:{0}|当前第{1}/{2}页", RecordCount, PageIndex, PageCount);
if (PageIndex == 1)
{
sb.Append("<span class=\"disable_pager\">首页</span>");
sb.Append("<span class=\"disable_pager\">上一页</span>");
}
else
{
sb.AppendFormat("<a class=\"first_pager\" href=\"javascript:void(0);\" onclick=\"{0}(1{1})\">首页</a>", FunName, FunParams);
sb.AppendFormat("<a class=\"prev_pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">上一页</a>", PageIndex - 1, FunName, FunParams);
}
int ShowMaxPageIndexCount = 5;
int ShowStartPageIndex = ((PageIndex - 1) / ShowMaxPageIndexCount) * ShowMaxPageIndexCount;
int ShowLastPageIndex = ((ShowStartPageIndex + ShowMaxPageIndexCount) > PageCount) ? PageCount : (ShowStartPageIndex + ShowMaxPageIndexCount);
if (ShowStartPageIndex > 0)
{
sb.AppendFormat("<a class=\"pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">...</a>", ShowStartPageIndex, FunName, FunParams);
}
for (int i = ShowStartPageIndex + 1; i <= ShowLastPageIndex; i++)
{
if (i == PageIndex)
{
sb.AppendFormat("<span class=\"current_pager\">{0}</span>", i);
}
else
{
sb.AppendFormat("<a class=\"pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">{0}</a>", i, FunName, FunParams);
}
}
if ((PageCount > ShowMaxPageIndexCount) && (ShowLastPageIndex < PageCount))
{
sb.AppendFormat("<a class=\"pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">...</a>", ShowLastPageIndex + 1, FunName, FunParams);
}
if (PageIndex == PageCount)
{
sb.Append("<span class=\"disable_pager\">下一页</span>");
sb.Append("<span class=\"disable_lastpager\">尾页</span>");
}
else
{
sb.AppendFormat("<a class=\"next_pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">下一页</a>", PageIndex + 1, FunName, FunParams);
sb.AppendFormat("<a class=\"last_pager\" href=\"javascript:void(0);\" onclick=\"{1}({0}{2})\">尾页</a>", PageCount, FunName, FunParams);
}
sb.Append("</div></div>");
}
return sb.ToString();
}