分享

KindEditor 取值和赋值

 aaie_ 2015-05-05

KindEditor 取值和赋值


应用版本:4.1.7


按照官网提示进行瘦身(看官网),设备如下:


一,webconfig中:



<configuration>

<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0" />

</system.web>

</configuration>


二、页面头部,必然要加上ValidateRequest="false"



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" ValidateRequest="false"

Inherits
="WebTest.WebForm2" %>


以上是避免恳求数据搜检时,报错:传输数占领风险。


三、HTML代码:



                    <textarea id="textContent" name="Descirpt" cols="70" rows="35" style="width: 700px;

height: 400px; visibility: hidden;" enableviewstate="true"></textarea>


四、初始化KindEditor并为其赋值,这里封装到一个办法里面,可以在AJAX恳求完成后,调用办法并把数据绑定到textarea中。此中,editor是全局变量,便利今后取值。



 var editor;

//绑定命据
function bindData(data) {
var options = {
width:
""700px""
height:
""400px""
uploadJson:
""/Scripts/KindEditor/asp.net/upload_json.ashx""
fileManagerJson:
""/Scripts/KindEditor/asp.net/file_manager_json.ashx""
allowFileManager:
true
afterBlur:
function () {
this.sync();
},
afterCreate:
function () {
this.sync();
}
}
editor
= KindEditor.create(""#textContent"", options);
prettyPrint();
editor.html(data);
}


五、批改完成后,取值就简单了,直接就是:editor.html()。。


在此,希罕感激:老胡,年老权,为乐。供给解析思路和帮助!!


 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多