asp.net use page breaks in the FCK editor to implement long article paging capabilities _ Practical Tips

Source: Internet
Author: User
Tags prev

The example in this article tells you that ASP.net uses page breaks in the FCK editor to implement a long article paging feature. Share to everyone for your reference, specific as follows:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "SplitContent.aspx.cs" inherits= "splitcontent"%>
<%@ Register assembly= "Fredck.fckeditorv2" namespace= "Fredck.fckeditorv2" tagprefix= "FCKeditorV2"%>
< ! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en"
"http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">
 
 
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls; Public partial class SplitContent:System.Web.UI.Page {private static string a = "<p> for many Chinese, Mrs Thatcher is a symbol. <br/> "+" "Mrs Thatcher is one of the few political women that has been in the news broadcast for a long time, and it is her budged hair that has remained in my childhood memory." "Netizen" little Snail and mother "in Micro Borrie wrote. <br/> "+" and she sent a similar feeling to millions of netizens-8 o'clock last evening Xu, the domestic media released news that the former British prime Minister Thatcher died of a stroke at the age of 87. <br/> "+" spokesman said that Thatcher died "very calm." The <br/> "+", a European political celebrity active in the Cold war era, has always been known as the "Iron Lady", a kind of "calm" evaluation, which is uncommon in her. </p> "+" <div style=\ "page-break-after:always\" ><span style=\ "display:none\" > </span></d Iv> "+" <p><br/> "+" for many Chinese, the first familiar with Mrs Thatcher from the "news broadcast" began. Her four visit to China and the signing of the Sino-British Joint Declaration on Hong Kong in 1984, when she first visited the country, laid the foundation for Hong Kong's reunification. <br/> "+" has "a" net friend recalls, "family always cheerfully said, I was 4 years old vowed to aspire, grow up to become like ' Mrs Thatcher ' as the woman, in fact, it was just followed the adult" news broadcast "see Much of the sequelae. <br/> "+" Mrs. Thatcher's many stories, also frequently appear in the soul of chicken soup, such as self-help books, the most famous one is "always sit in the front row" story. The story says the boy, who grew up in a small town in England, was taught by his father that no matter what it isTo strive for first-class, always sitting in front of others, but not behind the people, and finally, she grew up as a political star. <br/> "+" and the return of Hong Kong, is the Chinese people recall Mrs. Thatcher, not past the topic. Even after many years, people still relish the jokes about her confrontation with Deng Xiaoping. </p> "+" <div style=\ "page-break-after:always\" ><span style=\ "display:none\" > </span></d Iv> "+" <p><br/> "+" in 1982, when the British Prime Minister Thatcher visited China for the first time and met with Deng Xiaoping to discuss the issue of Hong Kong's sovereignty. Deng Xiaoping made it clear that there was no room for manoeuvre in the sovereignty issue, and what system Hong Kong would implement in 1997 years from China. <br/> "+" in the Great Hall of the Fojian held the talks, more than the scheduled 1.5 hours out of 50 minutes. At the end of the signing ceremony, happily a three-cup binge at a state dinner hosted by Mrs. Thatcher. As she jiuyi out of the hall, she suddenly stumbled on the steps and fell to her knees on one knee. Nearby reporters took the camera and grabbed the shot. </p> "+" <div style=\ "page-break-after:always\" ><span style=\ "display:none\" > </span></d Iv> "+" <p><br/> "+" This kneeling, became the world's newspaper the next day the most eye-catching news, some media said that the hard-line Thatcher met the opponent, "in her long history of politics, it seems only on one occasion she was beaten back to the prototype of a woman, that is in 198 2 years of Beijing "," compared with Deng, she is just a woman. "<br/>" + "Hong Kong finally returned smoothly, and the Chinese people have a great affection for Thatcher." "Unfortunately not able to extend the lease", in 2007, Thatcher in an interview to review the scene with the Chinese side, said there was no room for negotiations, "I appreciate the wisdom of Deng Xiaoping." <br/> "+" The day of Hong Kong reunification, she was also very sad-this is the "Iron Lady" rare feelings, she remembers the June 30, 1997 of the heavy rain, the last Governor Chris Patten stood beside the weeping daughter, look sentimental, "but I think I should not comment on this matter." It's going to be annoying. "<BR/></p> "; protected void Page_Load (object sender, EventArgs e) {if (! 
      IsPostBack) {//Article pagination page number int currentpage = request["Cpage"] = = null 1:convert.toint32 (request["Cpage"]);
      URL-Address string pageurl = Request.Url.ToString ();
    Articlepage (A, currentpage, pageurl); }///<summary>///article paging function///</summary>///<param name= "Content" > article content </param>/// <param name= "currentpage" > Current page number </param>///<param name= "pageurl" > Current page address </param> protected  void Articlepage (string content, int currentpage, string pageurl) {pageurl =!pageurl.contains ("?")? Pageurl + "?"
    : Pageurl.replace ("&cpage=" + CurrentPage, ""); int pagecount = 0;//page content = content. Replace ("<div style=\" page-break-after:always\ "><span style=\" display:none\ "> </span></div > ", [--page--]")//fck the default page break generated in IE, replaced by the custom page break content = content. Replace ("<div style=\" Page-bReak-after:always\ "><span style=\" display:none\ "> </span></div>", "[--page--]"); FCK The default page break generated in FF, replaced by the custom page break string[] tempcontent = System.Text.RegularExpressions.Regex.Split (content, "\\[--page--") );
    Gets the escape PageCount = Tempcontent.length of the page break "\\[" as "["; String outputcontent = "";//the content to be output if (PageCount <= 1) {outputcontent = content;
    Article content this.pnlPage.Visible = false; else {string pagestr = "";//Paging string Pagestr + = "<span class= ' count ' >" + PageCount + "</span
      > page "; if (currentpage!= 1) {pagestr + = "<a class= ' prev ' href =" + pageurl + "&cpage=" + (currentPage-1
      ) + "> Prev </a>"; for (int i = 1; I <= PageCount i++) {if (i = = currentpage) Pagestr + = ("<span CLA
        ss= ' active ' > ' + i + ' </span> '); else Pagestr = ("<a class= ' num ' href =" + pageurl + "&cpage=" + i + ">" + i + "</A> "); } if (CurrentPage!= pagecount) {pagestr = "<a class= ' next ' href =" + pageurl + "&cpage=" +
      (CurrentPage + 1) + "> next page </a>";
      } this.ltlPage.Text = Pagestr; Outputcontent = tempcontent[currentpage-1].
    ToString ();
  } this.ltlContent.Text = Outputcontent;

 }
}

More interested readers of asp.net related content can view the site topics: "asp.net operation JSON tips summary", "asp.net string operation tips Summary", "ASP.net Operation XML Skills summary", "asp.net file Operation skills Summary", " asp.net Ajax Skills Summary topic and the "ASP.net cache operation skills Summary."

I hope this article will help you to ASP.net program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.