主题: 自定义控件中KindEditor不显示
作者: gsdsdg, 发布日期: 2013-08-23 15:26:18, 浏览数: 3867
asp.net 中引用含KindEditor自定义控件,不显示KindEditor是什么?但自定义控件的其他内容可以显示
作者: 小浪子, 发布日期: 2013-08-23 16:29:44
代码呢?
回复
作者: gsdsdg, 发布日期: 2013-08-23 20:41:18

回复小浪子:

 

自定义控件:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="bjq.ascx.cs" %>

    <title></title>
        <link href="bjq/themes/default/default.css" rel="stylesheet" type="text/css" />
    <link href="bjq/plugins/code/prettify.css" rel="stylesheet" type="text/css" />
    <script src="bjq/kindeditor.js" type="text/javascript"></script>
    <script src="bjq/lang/zh_CN.js" type="text/javascript"></script>
 <script type="text/javascript">
     KindEditor.ready(function (K) {
         var editor = K.create('#content', {
             cssPath: 'kindeditor-4.1.7/plugins/code/prettify.css',
             uploadJson: 'kindeditor-4.1.7/asp.net/upload_json.ashx',
             fileManagerJson: 'kindeditor-4.1.7/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();
                // });
             },
             afterChange: function () {
                 K('.word_count1').html(this.count());
                 K('.word_count2').html(this.count('text'));
                 var self = this;
                 var clg = self.count()
                    var cl="<%=strlg %>";
                 if (clg > cl) {
                     var clg1 = clg - cl;
                     document.getElementById('xh').innerText = "超出了" + clg1 + "个字符";
                     self.sync("content");
                     //self.minChangeSize = 2;//undo/redo文字输入最小变化长度
                     self.pasteType = 0; //设置粘贴类型,0:禁止粘贴, 1:纯文本粘贴, 2:HTML粘贴
                     //cmd = K.cmd(document);
                     //cmd.cut();
                     codefull = self.fullHtml();
                     code = self.html();
                     codecount = self.count();
                 }
                 else {
                     var clg1 = cl - clg;
                     document.getElementById('xh').innerText = "可以容纳" + clg1 + "个字符";
                 }
             }
         });
     });
 </script>

        <textarea id="content" cols="100" rows="8" style="width:900px;height:300px;visibility:hidden;" runat="server"   ></textarea>
         <br />
                 <asp:Label ID="Label1" runat="server" Text=""  ></asp:Label>
        <p>
    您当前输入了 <span class="word_count1">0</span> 个文字。<br />
    您当前输入了 <span class="word_count2">0</span> 个文字。
   </p>
     <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="提交内容" onclick="Button1_Click"  /> (提交快捷键: Ctrl + Enter)

 

 

引用代码:

 <%@ Register TagPrefix="ed" TagName="edclass"   Src="bjq.ascx" %>              

<div>   <ed:edclass  id="edclass1"  runat="server"   /> </div>

 

改成自定义控件前测试正常,改成自定义控件后,可以显示:

“您当前输入了 0 个文字。
您当前输入了 0 个文字。

(提交快捷键: Ctrl + Enter)”

 

只有KindEditor界面不显示。

回复
发表新帖 发表回复