ASP. NET uses the Rich Text control KindEditor (one-step in place, which is valid for test), asp. netkindeditor

Source: Internet
Author: User

ASP. NET uses the Rich Text control KindEditor (one-step in place, which is valid for test), asp. netkindeditor
1. Copy the decompressed "KindEditor" folder to the root directory of the project (this KindEditor folder has been optimized)

For: http://pan.baidu.com/s/1eS1PRii

2. Introduce the KindEditor external style sheet file and necessary external js files in the <! -- Import a style sheet -->

<Link rel = "stylesheet" href = "../kindeditor/themes/default/default.css"/>

<Link rel = "stylesheet" href = "../kindeditor/plugins/code/prettify.css"/>

<! -- Introduce external js files -->

<Script type = "text/javascript" charset = "UTF-8" src = "../kindeditor/plugins/code/pretitor. js"> </script>

<Script type = "text/javascript" charset = "UTF-8" src = "../kindeditor/kindeditor-min.js"> </script>

<Script type = "text/javascript" charset = "UTF-8" src = "../kindeditor/lang/zh_CN.js"> </script>

3. Insert a multi-line text box Server Control (Textbox, note that its property TextMode is set to MutiLine). The generated tag is as follows:

<Asp: TextBox ID ="TxtCont"Runat =" server "TextMode =" MultiLine "Rows =" 5 "> </asp: TextBox>

Remember the ID of this control and use it in the next js Code.

4. Insert the <script> mark in the <! -- Start the KindEditor plug-in to convert a common multi-line text box into rich text -->

<Script type = "text/javascript">

KindEditor. ready (function (K ){

Var editor1 = K. create ('#TxtCont', {// Note that the ID here is consistent with the ID in the previous step.

CssPath: '../kindeditor/plugins/code/prettify.css ',

UploadJson: '../kindeditor/asp.net/upload_json.ashx ',

FileManagerJson: '../kindeditor/asp.net/file_manager_json.ashx ',

AllowFileManager: true,

AfterCreate: function (){

Var self = this;

K. ctrl (document, 13, function (){

Self. sync ();

K ('form [name = example] ') [0]. submit ();

});

K.ctrl(self.edit.doc, 13, function (){

Self. sync ();

K ('form [name = example] ') [0]. submit ();

});

}

});

PrettyPrint ();

});

</Script>

 

5. Copy the "\ kindeditor \ asp.net \ bin \ LitJSON. dll" file to the "bin" directory under the project root directory.

Note: "LitJSON. dllIt is a compiled Assembly file. Only with its support can we use upload images and other advanced functions.

 

6. Add an attribute to the Page command starting with the aspx file: ValidateRequest = "false"

The purpose of this operation is to submit the marked content. If this attribute is not added, the system will disable this illegal request based on security considerations.

 

7. Complete

Test the expressions, upload images, links, maps, and videos. If it succeeds, give me a thumbs up!

 

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.