文本编辑器 前后台获取值

来源:互联网 发布:香港淘宝网电话 编辑:程序博客网 时间:2024/06/06 00:25

如图所示文本编辑器
这里写图片描述
1.添加js引用

   <script src="../Content/assets/plugins/kindeditor/kindeditor-all-min.js"></script>    <script src="../Content/assets/plugins/kindeditor/lang/zh_CN.js"></script>

2.textbox控件,控制行数

       <asp:TextBox ID="txtRemark" runat="server" CssClass="form-control ie_widthauto" Rows="10" Style="width: 700px; height: 500px;" TextMode="MultiLine"></asp:TextBox>

3.JQuery控制

  var editor;        KindEditor.ready(function (K) {            editor = K.create('textarea[name="txtRemark"]', {                allowFileManager: true,                afterCreate: function () {                    var self = this;                    self.sync();                    $("#spanddl").mouseover(function () {                        editor.sync();                    });                }            });        });

4.后台代码

1.赋值给数据库recepInfo.Remark = txtRemark.Text.Replace("<", "[").Replace(">", "]").Replace("&nbsp;", "");2.从数据库中获取值this.txtRemark.Text = recepInfo.Remark.Replace("[", "<").Replace("]", ">");
0 0