ASP.NET 显示 Excel 文件的分页方法(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:40 点击:次
string OutPut = "";
for (int i = LeftNum; i <= RightNum; i++)
{
if (i == CurrentPage)
{
OutPut += "<span style='color:red'>" + i.ToString() + "</span> ";
}
else
{
OutPut += "<a href=\"" + PageUrl + "Page=" + i.ToString() + "\">" + i.ToString() + "</a> ";
}
}
if (CurrentPage > 1)
{
OutPut = "<a href='" + PageUrl + "Page=1'>首页</a> <a href=\"" + PageUrl + "Page=" + (CurrentPage - 1) + "\">上一页</a> " + OutPut;
}
if (CurrentPage < PageCount)
{
OutPut += " <a href=\"" + PageUrl + "Page=" + (CurrentPage + 1) + "\">下一页</a> <a href='" + PageUrl + "Page=" + PageCount + "'>末页</a>";
}
Pager.InnerHtml = OutPut ;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>孟宪会的Excel分页测试</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" ShowHeader="false">
</asp:GridView>
<div id="Pager" runat="server"></div>
</form>
</body>
</html>
作者:孟宪会
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>