分页符为“^”
这是读取的代码(包含页数的代码),写入的代码输入“^”就好了
char[] separator = { '^' };
String[] splitstrings = content.Split(separator);
if (page != "")
{
this.labContent.Text = splitstrings[Convert.ToInt32(page) -1].ToString();
}
else
{
this.labContent.Text = splitstrings[0].ToString();
}
string linkurl = "News.aspx?NewsID=" + id +"&";
string html = "";
int pagecount = splitstrings.Length;
int pp;
if (page == "" || page == null)
{
page = "1";
}
pp = Convert.ToInt32(page);
if (pagecount > 1) //当页数大于1的时候我们显示页数
{
if (pp - 1 > 0) //显示上一页,方便浏览
{ html = html + "<a href="" + linkurl +"&page=" + (pp - 1) +"">[上一页]</a> ";}
else
{
if (pp == 1)
{ html = html + "[<fontcolor=#cccccc>上一页</font>]"; }
else
{ html = html + "<a href="" + linkurl +"&page="" + (1) +"">[上一页]</a> ";}
}
for (int i = 1; i <= pagecount; i++)
{
if (i == pp)//如果是当前页,加粗显示
{ html = html + "<b>[" + i +"]</b> "; }
else
{ html = html + "<a href="" + linkurl +"&page=" + i + "">[" + i +"]</a> "; }
}
if (pp + 1 >pagecount) //显示下一页,方便浏览
{
if (pp == page count)
{ html = html + "[<fontcolor=#cccccc>下一页</font>]"; }
else
{ html = html + "<a href="" + linkurl +"&page=" + (pagecount) +"">[下一页]</a>";}
}
else
{
html = html + "<a href="" + linkurl +"&page=" + (pp + 1) +"">[下一页]</a>";
}
this.Label2.Text = html;
}
本文地址:http://blog.sina.com.cn/s/blog_5d71453e0100wtmt.html