• 在线富文本编辑器kindeditor配置(.Net Framework 3.5)


    下载地址:http://kindeditor.net/down.php

    解压放在项目要目录下,

    在Bin目录下添加引用:LitJSON.dll

    在页面头部加:

    <link rel="stylesheet" href="../kindeditor-4.1.10/themes/default/default.css" />
        <link rel="stylesheet" href="../kindeditor-4.1.10/plugins/code/prettify.css" />
        <script charset="utf-8" src="../kindeditor-4.1.10/kindeditor.js"></script>
        <script charset="utf-8" src="../kindeditor-4.1.10/lang/zh_CN.js"></script>
        <script charset="utf-8" src="../kindeditor-4.1.10/plugins/code/prettify.js"></script>
        <script>
            KindEditor.ready(function (K) {
                var editor1 = K.create('#content1', {
                    cssPath: '../kindeditor-4.1.10/plugins/code/prettify.css',
                    uploadJson: '../kindeditor-4.1.10/asp.net/upload_json.ashx',
                    fileManagerJson: '../kindeditor-4.1.10/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>

    页面内容:

    <li class="t4"><asp:TextBox ID="content1" runat="server"  Width="1000" Height="600"  CssClass="textBox"></asp:TextBox></li>       
                            <li class="t5">
                                <asp:Button ID="btnSend" runat="server" Text="上 传" CssClass="mBtn" OnClientClick="return CheckTextBox()" OnClick="btnSend_Click"/>          
                            </li>

    后台代码:

    protected void btnSend_Click(object sender, EventArgs e) {
            if (this.content1.Text.Trim().Length == 0) {
                HelperJS.Show(this.Page, "描述内容不能为空!");
                return;
            }
            else
                SaveDataInfo();
        }
        protected void SaveDataInfo() {
            string judge = Request.QueryString["action"];  //如果action为空,表示发布,action为e表示更新
            if (string.IsNullOrEmpty(judge)) {
                string sql = "insert into aboutus (typeName,aboutContent) values ('" + txtCName.Text.Trim() + "','" + content1.Text.Trim() + "')";
                if (Helper.HelperExecuteSql.ExecuteSql(sql) > 0) {
                    HelperJS.Show(this.Page, "发布成功!");
                    return;
                }
                else {
                    Helper.HelperJS.Show(this.Page, "发布失败!");
                    return;
                }
            }
            if (judge == "e") {
    
                string sql = "update  aboutus set typeName='" + txtCName.Text.Trim() + "',aboutContent='" + content1.Text.Trim() + "' where ID='" + Request.QueryString["id"].ToString() + "'";
                if (Helper.HelperExecuteSql.ExecuteSql(sql) > 0) {
                    HelperJS.Show(this.Page, "更新成功!");
                    return;
                }
                else {
                    Helper.HelperJS.Show(this.Page, "更新失败!");
                    return;
                }
            }
        }
    View Code
  • 相关阅读:
    《Java程序设计》第五周学习总结
    团队建设任务
    《Java程序设计》第四周学习总结
    ML_Review_GMM(Ch10)
    ML_Review_SVM(Ch9)
    ML_Review_LDA(Ch5)
    ML_Review_PCA(Ch4)
    关于Kernel的思考
    ML_Homework_Porject_2_LDA_KNN
    CV_Learn
  • 原文地址:https://www.cnblogs.com/shy1766IT/p/3734133.html
Copyright © 2020-2023  润新知