The use of ueditor in asp.net

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

The original address:

The initial Baidu at “ &rdquo editor;, may supply the choice also has a lot of, the use of more ckeditor, kindeditor, markItUp, ueditor etc.

A start to consider user ckeditor, the project is also used, but also foreign open source a good project, chose ckeditor. The use of a period of time that ckeditor has many places not in line with the Chinese habit, indent 2 Chinese characters, is I most cannot bear. There is, we often use “ insert code ” function, insert the code symbol had escaped.

While the ueditor is consistent with our habits, before the trial, due to a late start, there are a lot of bug, did not choose him. I recently went to ueditor's official website read, update to 1.2.6.1, try again, a lot of bug correction. So, now with him, well, nonsense ends. The specific method of use:

1 download address, website: http://ueditor.baidu.com/website/download.html#ueditor  I downloaded.Net UTF-8.

2 after decompression into the project to

3 in you want to use the local call, the first two sections of JS, a configuration, a ueditor

1

<script src="../Public/ueditor/ueditor.config.js" type="text/javascript"></script>

2

<script src="../Public/ueditor/ueditor.all.min.js" type="text/javascript"></script>

4 then is the initialization of ueditor, in the following code temp is access database information

1 <div id="myEditor" style="height:500px;"></div>
2

<script type="text/javascript">

3

var temp = document.getElementById("<%=hd_content.ClientID %>").value;

4

var ue = new baidu.editor.ui.Editor();

5

ue.render("myEditor");

//Fill in here to change as the editor of the ID control

6

ue.ready(function () { ue.setContent(temp); })

7

</script>

5 Finally, is the data storage method

1 <asp:Button ID="BtnSave" runat="server" Text="Preservation" onclick="BtnSave_Click" OnClientClick="return getContent();" CssClass="cssbtn" /> 

2 <script type="text/javascript">
3

function getContent() {

4

var temp = UE.getEditor('myEditor').getContent();

5

//alert(temp);

6

document.getElementById("<%=hd_content.ClientID %>").value = temp;

7

}

8

</script>

Attached: I used to hd_content just to transfer content. In the body form on the line.

1 <asp:HiddenField ID="hd_content" runat="server" Value="" />

Summary: the current version of 1.ueditor, path really don't configuration, the ueditor developers have been well, more convenient than before; the 2..Net version should upload problems, there is a default file compiled, to change the content (if you are a web site), right-click the file attributes, can be found.

Ha ha, ueditor is really good.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Donald at November 17, 2013 - 6:03 PM