kindeditor asp.net 模板问题 clientidmode="Static"

1、为了防止asp.net 修改 id, 必须加上clientidmode="Static"   .

2、关于 kindeditor 的脚本,写在master里面,如下(我要骂人了:link 到子页面的时候,会自动增加../; 但是script不自动增加):

<meta charset="utf-8" />
    <link rel="stylesheet" href="kindeditor-4.1.11-zh-CN/themes/default/default.css" />
    <link rel="stylesheet" href="kindeditor-4.1.11-zh-CN/plugins/code/prettify.css" />
    <script type="text/javascript" charset="utf-8" src="../kindeditor-4.1.11-zh-CN/kindeditor-all.js"></script>
    <script type="text/javascript" charset="utf-8" src="../kindeditor-4.1.11-zh-CN/lang/zh-CN.js"></script>
    <script type="text/javascript" charset="utf-8" src="../kindeditor-4.1.11-zh-CN/plugins/code/prettify.js"></script>
    <script type="text/javascript">
        KindEditor.ready(function (K) {
            var editor1 = K.create('#content1', {
                cssPath: '../kindeditor-4.1.11-zh-CN/plugins/code/prettify.css',
                uploadJson: '../kindeditor-4.1.11-zh-CN/asp.net/upload_json.ashx',
                fileManagerJson: '../kindeditor-4.1.11-zh-CN/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>
    3、关于 kindeditor 的脚本,自己的页面里面 都补上 ../

4.  

<asp:TextBox ID="content" runat="server" TextMode="MultiLine" Width="800px" Height="400px" ClientIDMode="Static"></asp:TextBox>

如果你一定需要服务器控件,那么加上红色的那个属性,加上了你设定的id值它就不会被改变,建议你了解一下ClientIDMode,.NET4的新特性。

原文地址:https://www.cnblogs.com/qqhfeng/p/9265284.html