First download a HTML5 editor KINDEDITOR-4.1.10-ZH-CN
Put the following files of the folder in the kindeditor-4.1.10-zh-cn Editor in your own project
Then in the path: kindeditor-4.1.10-zh-cn\kindeditor-4.1.10\jsp folder find demo.jsp with Notepad open reference inside the following:
<!doctype html>
<meta charset= "Utf-8"/>
<title>kindeditor jsp</title>
<link rel= "stylesheet" href= ". /themes/default/default.css "/>
<link rel= "stylesheet" href= ". /plugins/code/prettify.css "/>
<script charset= "Utf-8" src= ". /kindeditor.js "></script>
<script charset= "Utf-8" src= ". /lang/zh_cn.js "></script>
<script charset= "Utf-8" src= ". /plugins/code/prettify.js "></script>
<script>
Kindeditor.ready (function (K) {
var editor1 = k.create (' textarea[name= "content1"] ', {
Csspath: '. /plugins/code/prettify.css ',
Uploadjson: '. /jsp/upload_json.jsp ',
Filemanagerjson: '. /jsp/file_manager_json.jsp ',
Allowfilemanager:true,
Aftercreate:function () {
var = this;
K.ctrl (document, function () {
Self.sync ();
Document.forms[' Example '].submit ();
});
K.ctrl (Self.edit.doc, +, function () {
Self.sync ();
Document.forms[' Example '].submit ();
});
}
});
Prettyprint ();
});
</script>
and add it in the. aspx content page
<textarea name= "Content1" cols= "rows=" 8 "style=" width:793px;height:200px " ></textarea>
<asp:button id= "Btnok" runat= "Server" text= "Publish" height= "29px" width= "84px"
onclick= "Btnok_click"/>
The execution page will show that the editor appears in the page
But after you type in the text and give it a style and convert the text to HTML in the upper-left corner of the editor
Click Publish the following error occurs when you want to save him to the database:
Q:
Potentially dangerous request.form values were detected from the client (content= <p> test </p>).
I have tried to validaterequest=false, but still do not, just contact ASP. NET MVC development model, various is not very clear <%html.beginform ("Submitaddnews", "News", FormMethod.Post, new {id = "form"});%> This is the way to submit the hero to give guidance
Solution:
Add
That's OK.
Error when using text editor to pass style text to the database