用的fckeditor上的分页符按钮,分页代码是protected void PageNews(string news)
        {
            string[] a = new string[] { "<div style='page-break-after: always'><span style='display: none'>page break</span></div>" };
            string[] temp = news.Split(a, StringSplitOptions.RemoveEmptyEntries);
            //string[] temp = news.Split('^');
            int currentPage = 1;
            if (temp.Length <= 1)
            {
                this.lblContent.Text = news.ToString();
            }
            else
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    if (i == currentPage)
                    {
                        this.lblPageNumber.Text = "第" + i + "页 | ";
                    }
                    else
                    {
                        lblPageNumber.Text += "[<a href=LookArticle.aspx?id=" + HttpContext.Current.Request["id"].ToString() +
                        "&page=" + i + ">" + (i + 1) + "</a>]&nbsp;&nbsp;";
                        currentPage = i;
                    }
                    lblContent.Text = temp[currentPage].ToString();
                }
                //pageNum.Text += pageInfo;
            }
        }
那个数组a就是fck里的分页符代码,但是现在使用这个后无效,还是显示的全部文章
做过fckeditor分页的能不能给点代码参考下!

解决方案 »

  1.   

    http://blog.csdn.net/mayongzhan/archive/2007/11/21/1896932.aspx
      

  2.   

    现在的问题点击分页按钮还是现实第一条记录
    string[] a = new string[] { "<div style=\"page-break-after: always\"><span style=\"display: none\">page break</span></div>" };
                string[] temp = news.Split(a, StringSplitOptions.RemoveEmptyEntries);
                //string[] temp = news.Split('^');            int currentPage = 1;
                if (temp.Length <= 1)
                {
                    this.lblContent.Text = news.ToString();
                }
                else
                {
                    for (int i = 0; i < temp.Length; i++)
                    {
                        if (i == currentPage)
                        {
                            this.lblPageNumber.Text = "第" + i + "页 | ";
                        }
                        else
                        {
                            lblPageNumber.Text += "[<a href=LookArticle.aspx?id=" + HttpContext.Current.Request["id"].ToString() +
                            "&page=" + i + ">" + (i + 1) + "</a>]&nbsp;&nbsp;";
                            currentPage = i;
                            lblContent.Text = temp[currentPage].ToString();
                        }
                        
                    }
                }到底是下面的for循环哪里出错了呢?
      

  3.   

    改好了!代码protected void PageNews(string news,int page)
            {
                string[] a = new string[] { "<div style=\"page-break-after: always\"><span style=\"display: none\">page break</span></div>" };
                string[] temp = news.Split(a, StringSplitOptions.RemoveEmptyEntries);
                //string[] temp = news.Split('^');
                int currentPage = 1;
                if (temp.Length <= 1)
                {
                    this.lblContent.Text = news.ToString();
                }
                else
                {
                    for (int i = 0; i < temp.Length; i++)
                    {
                        if (i == page)
                        {
                            this.lblPageNumber.Text += "第" + (i+1) + "页 | ";
                        }
                        else
                        {
                            lblPageNumber.Text += "[<a href=LookArticle.aspx?id=" + HttpContext.Current.Request["id"].ToString() +
                            "&page=" + i + ">" + (i+1)+ "</a>]&nbsp;&nbsp;";
                            //currentPage = i;
                        }
                    }
                    lblContent.Text = temp[page].ToString();
                }
    我是在repeater里设置的,所以在repeater里还要加个参数这是最关键的!否则会报空指针!
    这个分页代码里稍微改动下就可以了郁闷的!