Insert the CKEditor editor into the. net page.

Source: Internet
Author: User


First, configure and download.
Then, put the folder in the web root directory.
OK, now you can.

The front-end code is as follows:
[Html]
<Head runat = "server">
<Title> </title>
<Script type = "text/javascript" src = "ckeditor/ckeditor. js"> </script>
</Head>
<Body>
<Form id = "form1" method = "post" runat = "server">
<Div style = "width: 500px; height: 300px;">
<Asp: TextBox ID = "txtContent" runat = "server" TextMode = "MultiLine" CssClass = "ckeditor"> </asp: TextBox>
<Asp: Button runat = "server" Text = "save" ID = "btn_ OK" onclick = "btn_ OK _Click"/>
</Div>
</Form>
</Body>

<Head runat = "server">
<Title> </title>
<Script type = "text/javascript" src = "ckeditor/ckeditor. js"> </script>
</Head>
<Body>
<Form id = "form1" method = "post" runat = "server">
<Div style = "width: 500px; height: 300px;">
<Asp: TextBox ID = "txtContent" runat = "server" TextMode = "MultiLine" CssClass = "ckeditor"> </asp: TextBox>
<Asp: Button runat = "server" Text = "save" ID = "btn_ OK" onclick = "btn_ OK _Click"/>
</Div>
</Form>
</Body>

The background code is just a simple way to get the content in TextBox. The following contains the data I used for testing and writes it into a txt text.
[Csharp]
Protected void Page_Load (object sender, EventArgs e)
{
If (! IsPostBack)
{
String strPath = "E :\\ jin \ CompanyProject \ WebSite \ Web \ txt. Txt ";
// Read:
TxtContent. Text = File. ReadAllText (strPath );
}
}
Protected void btn_ OK _Click (object sender, EventArgs e)
{
String Data = txtContent. Text;
// String st = Request. Form. Set [form1]. tostring ();
String Data2 = Request. Form [txtContent. Text. ToString ()];
String strContent = Data;
String strPath = "E :\\ jin \ CompanyProject \ WebSite \ Web \ txt. Txt"; // such as: D:/Text/File. Txt
File. WriteAllText (strPath, strContent); // save the File
}

Protected void Page_Load (object sender, EventArgs e)
{
If (! IsPostBack)
{
String strPath = "E :\\ jin \ CompanyProject \ WebSite \ Web \ txt. Txt ";
// Read:
TxtContent. Text = File. ReadAllText (strPath );
}
}
Protected void btn_ OK _Click (object sender, EventArgs e)
{
String Data = txtContent. Text;
// String st = Request. Form. Set [form1]. tostring ();
String Data2 = Request. Form [txtContent. Text. ToString ()];
String strContent = Data;
String strPath = "E :\\ jin \ CompanyProject \ WebSite \ Web \ txt. Txt"; // such as: D:/Text/File. Txt
File. WriteAllText (strPath, strContent); // save the File
}
The effect is as follows:

 
 

 

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.