现在的位置: 首页 > 综合 > 正文

较长文章分页(AspNetPager控件)

2012年09月11日 ⁄ 综合 ⁄ 共 480字 ⁄ 字号 评论关闭
string ResponseText="";
   string text = "新闻文章内容";

   this.AspNetPager1.RecordCount = text.Length;
   int PageSize = this.AspNetPager1.PageSize;
   int PageIndex = this.AspNetPager1.CurrentPageIndex;

   if (this.AspNetPager1.CurrentPageIndex != text.Length / PageSize + 1)
   {
    ResponseText = text.Substring((PageIndex - 1) * PageSize, PageSize);
   }
   else
   {
    ResponseText = text.Substring((PageIndex - 1) * PageSize, text.Length - ((PageIndex - 1) * PageSize));
   }
   TB_View.Rows[0].Cells[0].InnerHtml = ResponseText;

抱歉!评论已关闭.